AntonelloDN / ShrimpGIS

A basic plugin for Grasshopper to read and write shapefile and geojson (GPL)
GNU General Public License v3.0
17 stars 3 forks source link

Mismatch of value for Degree in *.prj file #1

Closed eap23 closed 4 years ago

eap23 commented 4 years ago

Hi,

the projection of a file from ArcGIS does not entirely match the export of the ShrimpGIS pluign.

I've found this comment in lib/shrimp_gis/io/write.pycode:

#TODO: Add epsg code as input. Call epsg.io API or other to retrieve prj string. Write prj file. It does not work within Rhino for now. def write_prj_file(self, folder, file_name): wgs84prjString = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"

and am wondering where you've got the data for wgs84prjString from.

In particular the value of Degree does not exactly match in the *.prj files, thus the projcetion is shifted. From the ArcGIS *.prjfile: PROJCS["WGS_1984_UTM_Zone_33N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",15.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

Watch the different values for Degree, although both are using WGS.

Thanks, Eduard

AntonelloDN commented 4 years ago

@eap23 thanks for your comment. ShrimpGIS 1.0.0 release has a declared limit, it can read/write only shapefile that use WGS84(EPSG:4326). It is the common latitude/longitude system based on the Earth's center of mass that is part of GCS family (geographic coordinate system) where you work on a sphere - despite of your screen is flat. Factory code is EPSG:32633 in your case and it is part of PCS family (projected coordinate system). A solution with ShrimpGIS 1.0.0 is to use projections functionalities of ArcGIS or similar to get coordinate in WGS84(EPSG:4326).

Mistmatch of degree is because I am using ESRI WKT dialect. I can change string with this: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]] Like it is suggested in physhp: https://code.google.com/archive/p/pyshp/wikis/CreatePRJfiles.wiki

Below some references: https://epsg.io/4326 https://epsg.io/32633 https://support.esri.com/en/technical-article/000011199 https://docs.qgis.org/testing/en/docs/gentle_gis_introduction/coordinate_reference_systems.html#coordinate-reference-system-crs-in-detail

I hope it helps and to add a portable and easy to install library to manage different CRS in next release. Any comment from you or other GIS experts is welcome.

AntonelloDN commented 4 years ago

@eap23 #https://github.com/AntonelloDN/ShrimpGIS/commit/b96271e143675de74a70f69b11d484ddb09a7f48 Thanks again. If it works also for you, I close this issue.

eap23 commented 4 years ago

Thanks @AntonelloDN !