I have shape vector layer in ESPG:3859 CRS. I try to get layer crs


but method always returns EPSG:4326 no matters which CRS I chose in layer properties.

.qpj file for shape layer:

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 +nadgrids=@null +wktext  +no_defs"],AUTHORITY["EPSG","3857"]]


  • Can you insert the content of the .prj file? – AndreJ Jun 14 '14 at 7:39
  • Yep, I have edited original message. – dmitry.v.kiselev Jun 14 '14 at 10:01

You ask for the ID of the geographic CRS, and that is correctly EPSG:4326 in your case:


as you find before the projection parameters.

Geographic CRS is lat/lon degrees, and the basis for the projection to Mercator, Transverse Mercator or whatever projection is used.

You may intend to ask for layer.crs.authid() instead.

|improve this answer|||||
  • I have mistaken, and add .qpj instead of .prj I have added them both. Any way shape was created in QGIS and .prj and.qpj also creted with QGIS. I have tried to export layer to geo json without any reprojection, and coordinates seems to be with 3857. – dmitry.v.kiselev Jun 14 '14 at 10:33
  • shouldn't it be layer.crs().authid() ? – chenghopan Apr 27 '17 at 2:14
  • @chenghopan probably yes, but I don't know the code around that line in detail. – AndreJ Apr 27 '17 at 5:25

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.