[Qgis-user] What's wrong with PRJ file for CRS 3857?

Andre Joost andre+joost at nurfuerspam.de
Wed Sep 16 11:31:38 PDT 2015


Am 16.09.2015 um 11:46 schrieb Redoute:
> This question is arising from
> http://gis.stackexchange.com/questions/162779/why-is-the-city-of-san-francsico-floating-over-point-richmond
>
> I create a shapefile in QGIS in CRS 3857. I delete the .qpj file and
> load the shapefile again. The features then are placed wrong, the
> Cologne Cathedral shows up in a lake near Duesseldorf :-((. So I reason
> there is something wrong with the .prj file.
>
> What is it? Is it a bug in GDAL/OGR?

No, it is a bug in the way that google has invented its "Mercator" 
projection, see 
http://gis.stackexchange.com/questions/74734/spherical-mercator-projection-invented-by-google-and-not-conformal 
for some explanation. And 
http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf 
for some more rants of GIS people on that projection.

The proj.4 definition is:

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 
+k=1.0 +units=m +nadgrids=@null +wktext  +no_defs

which uses a sphere, while the WKT definition in the .prj file is using 
the ellipsoid:

PROJCS["WGS_84_Pseudo_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],PARAMETER["standard_parallel_1",0.0]]

There is a similar projection EPSG:3395, which is in proj.4

+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs

and in WKT:

PROJCS["WGS_84_World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],PARAMETER["standard_parallel_1",0.0]]

As you see, both WKT are the same, but proj.4 are not. QGIS therefore 
writes the proj.4 string and the EPSG code into its own .qpj file, to 
get the right projection. But if you only have the .prj (maybe because 
you get the data from ESRI software), you are out of luck, and the data 
is misplaced about 30 km North.

HTH,
André Joost





More information about the Qgis-user mailing list