C# Library for converting Shapefile Projection - projection

Is there any C# library which can take a shapefile as an input with projection information defined (e.g, EPSG 3011) and return a new shapefile with user specified projection (e.g, EPSG 4326) ?

When it comes to projections, the de-facto standard is PROJ4. A simple google search of "proj4 c# wrapper" resulted in some promising results, like this one:
http://osgeo-org.1560.n6.nabble.com/C-NET-wrapper-updated-td3841800.html
library lives in http://ftp.dfg.ca.gov/Public/BDB/Tools/proj4/
I haven't personally tested though.

Related

how to convert world lat and long coordinates to something ONE simulator understands?

I have the coordinates of Manhattan in a .wkt file and an example of that file content is: LINESTRING (40.619605 -73.9584046, 40.6205286 -73.9585793, 40.6206127 -73.9585952)
ONE simulator does not recognize such coordinates to display the map of Manhattan and instead needs something that looks like this: LINESTRING (4883.179 10736.259, 4924.922 10811.716)
I'm not sure what format that is nor not sure what to search for in google. I need to know how to convert from LINESTRING (40.619605 -73.9584046, ... to something like LINESTRING (4883.179 10736.259, 4924.922 10811.716)
preferred language is python, thanks.
The format ONE uses is subset of the standard WKT format. See details in the WKTReader class and ReadMe.
The coordinates used in the WKT input files are in reference to the simulation world coordinates. You can open your source map file with a WKT editor (e.g., OpenJUMP) and translate the coordinates so that they’re all positive and that could be enough.

How can I edit the values of coordinates within a geojson file?

I am trying to map a geojson file (A map of Alaska precincts, downloaded from the division of elections and then converted online to geojson) onto a choropleth map using folium, the problem is the coordinates are in 7-digit numbers like this:
[ -16624764.227, 8465801.1497 ]
I read on a similar post that this was most likely a US coordinate system like UTM or State Plane, and recommended using an API to reproject it. Is it also possible to access the coordinates directly such as with geopandas and divide them by 100000?
The data is most likely in a specific cartographic projection. You don't just want to divide by 100k - the data will likely have nonlinear transformations which have a different effect on the position depending on the location. See the GeoPandas docs on working with projections.
If the CRS of the data is correctly encoded, you can re-project the dataframe into lat/lons (e.g. WGS84, which has the EPSG Code 4326) using geopandas.GeoDataFrame.to_crs, e.g.:
df_latlon = df.to_crs("epsg:4326")

Is there a javascript library to reproject a geojson so that mapbox gl will render it looking like 'Plate-Carrée'?

I'm building a web application using Angular and mapbox-gl-js as map library.
The map tiles are projected using EPSG:4326 Plate-Carrée and the dataset is GeoJson (WGS84).
Since mapbox supports only web mercator projection, the data is not displayed in the correct position on map.
Any suggestions how to reproject the dataset so mapbox is able to display the data in the correct location?
Thanks.
If I understand your question correctly, you have some raster tiles which are "projected" (well, not really) in EPSG:4326, and you would like to display them in Mapbox-GL-JS. You also have another dataset, in GeoJSON, also provided in EPSG:4326, which you would like to overlay.
As you note, Mapbox-GL-JS only supports the EPSG:3857 (Web Mercator) projection. It projects datasets (but not raster tiles) from EPSG:4326 to EPSG:3857 in order to display them.
Your good options are:
Find a different basemap in Web Mercator
Find a web service which can reproject the tiles you have on the fly
Maybe there's some way where you could let Mapbox-GL-JS think it's displaying your tiles in EPSG:3857, then somehow adjust the coordinates of your overlaid dataset so that when they're reprojected from EPSG:4326 to EPSG:3857 they end up in the right positions. But I can't think how to achieve that.
You could try asking at gis.stackexchange.com.

proj4string doesn't seem to completely define ESRI projection information

I have a shapefile that I imported into R using readOGR from the rgdal package. I do a little bit of work with it, like adding attribute information, etc, then export it as an ESRI shapefile again, with a new name. However, when I bring both the original and new shapefile into ArcGIS, it tells me that the CRS does not match.
So, noting that all the projection parameters remain the same, but the projection and coordinate system names are different, and the datum
name is dropped, my questionas are:
Is the second CRS the same as the first?
If so, why did the names change, and why does ArcGIS no longer recognize it as the same?
If not, how did it get changed?
Can the proj4string be modified to be more specific, and if so, why did readOGR not already do this to preserve all the information?
I can use the new shapefiles just fine, but it would be nice to know that
the CRS is identical to the original. And, I could of course define it again in ArcGIS, but part of the motivation to work in R
is to obviate the need to point and click for many files.
I appreciate any insights or enlightenment.
Here is the original projection information from ArcGIS:
Projected Coordinate System: NAD_1983_HARN_Transverse_Mercator
Projection: Transverse_Mercator
False_Easting: 520000.00000000
False_Northing: -4480000.00000000
Central_Meridian: -90.00000000
Scale_Factor: 0.99960000
Latitude_Of_Origin: 0.00000000
Linear Unit: Meter
Geographic Coordinate System: GCS_North_American_1983_HARN
Datum: D_North_American_1983_HARN
Prime Meridian: Greenwich
Angular Unit: Degree
Here is the proj4string from R, which also agrees with the proj4string given for this projection at www.spatialreference.org for epsg:3071 and also for SR-ORG:7396.
+proj=tmerc +lat_0=0 +lon_0=-90 +k=0.9996 +x_0=520000 +y_0=-4480000 +ellps=GRS80 +units=m +no_defs
When I use writeOGR to export the SpatialPolygonsDataFrame with the above proj4string, then bring it back into ArcGIS, the
projection information is given as the following, and is no longer recognized as the original.
Projected Coordinate System: Transverse_Mercator
Projection: Transverse_Mercator
false_easting: 520000.00000000
false_northing: -4480000.00000000
central_meridian: -90.00000000
scale_factor: 0.99960000
latitude_of_origin: 0.00000000
Linear Unit: Meter
Geographic Coordinate System: GCS_GRS 1980(IUGG, 1980)
Datum: D_unknown
Prime Meridian: Greenwich
Angular Unit: Degree
Perhaps not a definitive answer, but I posted this question on the R-sig-Geo list serve, and got a few possible work-around solutions. For now, I simply used an R-script to overwrite the .prj file with a copy of the original, and that seems to work fine. Also suggested was the use of a package called arcgisbinding to bridge ArcGIS and R (and maybe a similar solution would be available for QGIS?). I have not verified the arcgisbinding solution, but more information can be found at the the blog post here and in the package documentation here.

How to use equirectangular projection in TileMill?

I need to get an equirectangular projected map out of TileMill (http://en.wikipedia.org/wiki/Equirectangular_projection).
I found a tutorial online explaining how to get a different projection by altering the project's setting in the 'project.mml' file.
(http://blog.kartena.se/using-tilemill-without-spherical-mercator/)
And I found what I thought to be a description of the necessary srs code for an equirectangular projection:
"srs": "+proj=longlat +ellps=WGS84 +no_defs"
However, the map no just shows a long thin line of water, nothing else, so clearly that's not quire right.
I've been scouring for more detail about how to set this up but I'm totally stumped.
The Web Mercator projection is no good for my purposes.
Anyone know how to do this?
Thanks so much.
S
This won't be possible in TileMill itself: the software is designed to output Spherical Mercator tiles only. Your best option would be to export Mapnik XML from TileMill, modify it to support EPSG:4326, and then serve the tiles from something like TileStache.

Resources