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

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.

Related

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")

Exporting images out of GEE with custom projection

I want to export a series of Landsat scenes in Africa (that natively have different UTM projections) and work on them in GIS software. To have the pixel boundaries at overlapping regions properly, I think I have to reproject my scenes to a common projection, for which I would like to use Africa_Albers_Equal_Area_Conic projection. I find this projection with authority ESRI:102022 on spatialreference.org, with below wkt definition:
PROJCS["Africa_Albers_Equal_Area_Conic",
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]],
PROJECTION["Albers_Conic_Equal_Area"],
PARAMETER["False_Easting",0],
PARAMETER["False_Northing",0],
PARAMETER["longitude_of_center",25],
PARAMETER["Standard_Parallel_1",20],
PARAMETER["Standard_Parallel_2",-23],
PARAMETER["latitude_of_center",0],
UNIT["Meter",1],
AUTHORITY["EPSG","102022"]]
I put this as the argument of ee.Projection() function and do the export this way (imageA is the input image):
var EPSG102022 = ee.Projection('PROJCS["Africa_Albers_Equal_Area_Conic",...)
var imageA_2 = imageA.reproject({crs:EPSG102022, scale:30})
var projectionA_2 = imageA_2.projection().getInfo()
Export.image.toDrive({
image: imageA_2,
description: 'TEST_A_reprojectWscale',
crs: projectionA_2.wkt,
scale: 30,
region: ROI
});
But when I do the export and load the original and reprojected image on ArcGIS, I see the reprojected image being misplaced. When I look at the reprojected image spatial reference in ArcGIS, I see that there is no "longitude_of_center" parameter there, brt there is a parameter named "central meridian" which is set to zero. Also the authority is not shown and it only says the projection authority is "custom".
Then I renamed "longitude_of_center" in the wkt string to "central_meridian" and exported the image again. The image was still misplaced. When I looked at its spatial reference, I found that the central meridian parameter is still zero, although I set it to be 25 in the wkt definition.
Then I set the "central_meridian" parameter in wkt definition to zero and exported the images again. This time the image was correctly placed on the map.
I am completely confused. Why there are different names for the projection parameters in different wkt's and why different softwares name the projection definition parameters differently? This looks like a very poor standard. Also, why ArcGIS does not follow the definition that I put in the exported file (setting central meridian to 25)?

How to write projection info into netcdf file use xarray?

I need to use xarray to write the projection information into the netcdf file so that Iris can directly obtain the projection information when reading it.
We know that there are many projection s in cartopy, such as equal latitude and longitude projection, Lambert projection, etc. How to write this information into netcdf file? Is it similar to an epsg string?
For Iris, you most likely want to encode the grid projection information in a grid_mapping attribute on the data variables according to the Climate and Forecasting netCDF Conventions.

Trouble projecting point data from csv file in ArcMap

I'm trying to project some point data in ArcMap.
I created the point data in excel, then summarised it in R and exported it as a csv. Then added it through 'add XY data' tool in ArcMap, and exported it from an events file to a shapefile.
The points appear in the correct place, relative to each other, but when tried to overlay on the world imagery basemap, it simply sits down near Antarctica.
I've checked and re-checked the projections of the imported layer and the dataframe (I'd like to work in GDA_1994_MGA_Zone_56), but have also tried changing to a geographic coordinate system, which doesn't change anything.
In fact, when I try to change the projection to a gcs, using the 'project - data management' tool, this error comes up.
invalid extent for output coordinate system
Failed to execute (Project).
I can't for the life of me figure out what is going wrong, there's probably a simple explanation, but I'm at my wits end!
It helps to have them stored originally as numeric data, but since it's actually coming in as a CSV, I think they are importing as numeric -- as you note, they are correct relative to each other.
If your points are showing up on a map but in the wrong location, then their initial projection definition is incorrect. Looking at the Add XY Data dialog, you need to specify an initial coordinate system. If nothing is specified, ArcMap assumes that it is latitude/longitude decimal degrees.
Once it's imported as the wrong coordinate system, attempts to reproject will just continue the But you do not necessarily need to delete the points and start to re-import from scratch. Try using the Define Projection tool (which modifies the metadata to the desired projection) instead of Project (which mathematically recalculates coordinates from current projection to a new projection).

C# Library for converting Shapefile 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.

Resources