I am using ogr2ogr to reproject a shapefile. Here is what I have done.

  1. I have a shapefile A.shp. I used the following command to create B.shp: ogr2ogr -t_srs EPSG:3857 B.shp A.shp
  2. Now I reprojected B.shp again and created C.shp ogr2ogr -t_srs EPSG:3857 C.shp B.shp

Since B and C have same data and they are in same projection, I think they should completely overlap. However the do not. In the image bellow the Red one is A.shp and the other one is B.shp.

Is there a good reason why this can happen? This is happening to all the shapefiles not just this one.

enter image description here


You might get a shift if the source CRS of the original shapefile is not given by an EPSG code, but a .prj file. These do not include datum sift parameters, and gdal tries to match the WKT information with its own EPSG database.

So I suggest to always add the -s_srs parameter for all ogr2ogr operations.

  • So, do you mean that the information in .prj file is not sufficient to do the reprojection?
    – Mohayemin
    Apr 29 '15 at 10:45
  • If it is a CRS that has a datum shift (+towgs84 different from zero) in the EPSG code, it is not sufficient.
    – AndreJ
    Apr 29 '15 at 11:02

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.