[gdal-dev] Transform shapefile to specific WKT format

jvenman jvenman at noggin.io
Tue Jul 24 17:48:17 PDT 2018


Hi - I have an shapefile that has a .prj file with this format for GDA94
(4283):-

GEOGCS["GDA94",DATUM["D_GDA_1994",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

And the application that needs to read it complains that it's a different
projection from the representation of GDA94 (4283) that it understands which
is this:-

GEOGCS["GCS_GDA_1994",DATUM["D_GDA_1994",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

They're subtly different in the precision on the Degree value and the
presence of ".0" on the Spheroid which seems to be enough to make the target
application reject it. I'd like to ogr2ogr my way past this by being very
specific about the srs for the target shapefile. I've tried various
combinations of format for the -a_srs parameter and I always end up with
what I think is the definition of GDA94 (4283) that GDAL has in gdal_data
which is this:-

GEOGCS["GDA94",DATUM["D_GDA_1994",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

I have tried specifying the WKT like this:-

ogr2ogr --config GDAL_DATA "C:\Program Files\GDAL\gdal-data" -a_srs
"GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
-f "ESRI Shapefile" GDA94Test_TargetBRIMS1002.shp
Fire_Nr_Davidson_Point_1.shp

And I have tried specifying the a .prj file that is exactly the format I
want like this:-

ogr2ogr --config GDAL_DATA "C:\Program Files\GDAL\gdal-data" -a_srs
ESRI::BRIMS_Schema.prj -f "ESRI Shapefile" GDA94Test_TargetBRIMS1003.shp
Fire_Nr_Davidson_Point_1.shp

I know I could just overwrite the existing prj file with the one I want, but
I'd like to do it through ogr2ogr if it's possible. Can anyone point me in
the right direction or point out what I'm doing wrong?

Thanks,
Josh







--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list