I have a geodatabase that I would like to convert to shapefile with epsg:4326 projection. For this I use ogr2ogr.

However when I reproject, the results are offenter image description here. They seem to have shifted?

Any idea why?

The commands I'm using:

/opt/anaconda3/envs/python35/bin/ogr2ogr -f 'ESRI Shapefile' /volumes/data/Y2018M08D13_RH_Process_Basisregistratie_Gewaspercelen_V01/process2_V07/BRP_Gewaspercelen_2009.shp /volumes/data/Y2018M08D13_RH_Process_Basisregistratie_Gewaspercelen_V01/process_V07/BRP_Gewaspercelen_2009.gdb

and then convert to epsg 4326 (I used to do everything in one step but split for debugging purposes)

/opt/anaconda3/envs/python35/bin/ogr2ogr -t_srs EPSG:4326 /volumes/data/Y2018M08D13_RH_Process_Basisregistratie_Gewaspercelen_V01/output_V07/BRP_Gewaspercelen_2009.shp /volumes/data/Y2018M08D13_RH_Process_Basisregistratie_Gewaspercelen_V01/process2_V07/BRP_Gewaspercelen_2009.shp

Geodatabase: http://geodata.nationaalgeoregister.nl/brpgewaspercelen/extract/2009-definitief/brpgewaspercelen.zip

The file geodatabase has this metadata crs:

+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.4171,50.3319,465.5524,-0.398957,0.343988,-1.87740,4.0725 +units=m +no_defs
  • What projection is your basemap in? – Trevor J. Smith Aug 14 '18 at 19:13
  • web mercator, OTF reprojection – RutgerH Aug 14 '18 at 19:15
  • My guess is that the crs of the geodatabase is different than what it should be. Might need to overwrite input crs – RutgerH Aug 14 '18 at 19:16
  • 1
    and this worked: ogr2ogr -s_srs EPSG:28992 -t_srs EPSG:4326 -f 'ESRI Shapefile' outfile.shp infile.gdb – RutgerH Aug 14 '18 at 20:02
  • 1
    You should add this as an answer and close it. I can see myself getting tripped up on this as well. – Trevor J. Smith Aug 14 '18 at 21:11

The projection of the shapefiles is not wrong, it just lacks the datum shift (as ESRI shapefiles do per definition, while ogr2ogr needs it). So you have to add the EPSG code for the source and target CRS to do it right.

From your comment, this command line works:

 ogr2ogr -s_srs EPSG:28992 -t_srs EPSG:4326 -f 'ESRI Shapefile' outfile.shp infile.gdb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.