Bug report #7368

QGIS writing out incorrect .prj file

Added by Gavin Fleming over 7 years ago. Updated over 1 year ago.

Category:Projection Support
Affected QGIS version:master Regression?:No
Operating System:ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:16341


QGIS 1.9 nightly build

Save a layer as a shapefile in EPSG 3857 and different prj and qpj files are written out. The prj file is inadequate. I picked this up when using the output shapefile as a gdalwarp cutline and the output raster cut was shifted by several kilometres. gdalwarp reads the prj file, not the qpj file. I renamed the qpj file to .prj and this solved the problem.




PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+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 [email protected] +wktext  +no_defs"],AUTHORITY["EPSG","3857"]]


#1 Updated by dr - almost 7 years ago

Confirm such behavior on latest master.

#2 Updated by Chris Matthews almost 7 years ago

I am also having trouble with the .prj file QGis is creating when working with 3857. I'm using Qgis 2.0.1

#3 Updated by Etienne Tourigny almost 7 years ago

confirmed. look like the ogr provider needs updating... probably too late to include this in 2.2 though! At least there is a workaround.

#4 Updated by Etienne Tourigny almost 7 years ago

Fixing this would require fixing QgsVectorFileWriter() and copying the .qpj file to .prj file.

#5 Updated by Jürgen Fischer almost 7 years ago

Etienne Tourigny wrote:

Fixing this would require fixing QgsVectorFileWriter() and copying the .qpj file to .prj file.

Producing the .qpj is a workaround because OGR converts the SRS to ESRI WKT for the .prj (ie. OSRMorphToESRI()) and that's not lossless. QGIS prefers the .qpj with the original information over the .prj. Keeping the original information is the whole point of the .qpj.

#6 Updated by Giovanni Manghi over 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF