7

My issue is closely related to:

and somewhat similar to:

but it seems that the root of the problem is different.

I am downloaded a shapefile (and all its necessary additional files) from a government repository. When I load the shapefile into QGIS, the CRS is not automatically detected even though a .prj file is in the folder.

enter image description here

How can I tell QGIS : "please look here and use this .prj file."

DETAILS:

Despite indicating that they use a standard projection (Canada_Albers_Equal_Area_Conic, ESPG: 102001), it actually seems to be a custom projection with a slight tweak to that standard so I can't just choose a CRS from the menu. [If I select "Canada Albers Equal Area Conic", then the polygons are displaced relative to where they should be based on other files for which I know the projection is correct]

The .prj file looks like this:

PROJCS["Canada_Albers_Equal_Area_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
    PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],
    PROJECTION["Albers"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-95.0],
    PARAMETER["Standard_Parallel_1",49.0],PARAMETER["Standard_Parallel_2",77.0],PARAMETER["Latitude_Of_Origin",49.0],UNIT["Meter",1.0]]

When I load the file in R, the projection is automatically detected correctly:

> crs(test)
CRS arguments:
 +proj=aea +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0
+datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

To compare with standard Albers:

CRS arguments:
 +proj=aea +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0
+datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

If I compare the output provided by the http://epsg.io/102001 website (suggested in an answer), I get the following for the OGC WKT (standard way of writing projections?) for the standard Canada Albers projection:

PROJCS["Canada_Albers_Equal_Area_Conic",GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["longitude_of_center",-96],PARAMETER["Standard_Parallel_1",50],PARAMETER["Standard_Parallel_2",70],PARAMETER["latitude_of_center",40],UNIT["Meter",1],AUTHORITY["EPSG","102001"]]

And the following as the ESRI WKT way of writing the projection:

PROJCS["Canada_Albers_Equal_Area_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["central_meridian",-96],PARAMETER["Standard_Parallel_1",50],PARAMETER["Standard_Parallel_2",70],PARAMETER["latitude_of_origin",40],UNIT["Meter",1]]

I am noticing slight differences in the language/terms used to set the projection.

1
  • Strangely, gdalsrsinfo on your .prj works for me, and adding it to a test.shp QGIS does not complain. Can you link to the download source?
    – AndreJ
    Jan 31, 2018 at 7:24

1 Answer 1

6

The problem is that the .prj is not standardized. You can have several slightly different definitions. For example is the datum value for your EPSG in OGC WKT "North_American_Datum_1983" and in ESRI WKT "D_North_American_1983". Depending on the used program it matches the inbuilt list of defintions or not. It is a well known porblem of QGIS that it often does not recognize .prj that were created by ESRI products.

You can solve it by writing the .prj with QGIS (save as) or by copying the defintions from one of the many EPSG sites like http://epsg.io/102001 . Also QGIS uses its own file .qpj for coordinate reference.

4
  • To unpack what you wrote (sorry I have difficulty with the terminology). 1. QGIS does not recognize non-standard .prj (particularly if they were created by an ESRI product) while R (rgdal) does recognize those non-standard .prj. 2. Solution is to write the .prj with QGIS... How? Jan 31, 2018 at 14:08
  • And the way to tell (from looking at the .prj file in notepad) that it is an ESRI-product derived projection is based on the way the projection file is written? See the details I added to my question. Jan 31, 2018 at 14:23
  • 2
    The shapfile white paper does not say anything about the .prj. It is not part of the standard. That is why any software or library can use it differently and you still have a "shapefile". The file format was never intended for what it is used widely today. Therefore you have several issues when switching programs. If you stay within QGIS you can just set correct crs in the properties and export the layer to a new file. QGIS writes a .prj in its style and also a .qpj . You can´t really tell in which program the .prj file was created. It was just a guess from my side.
    – Matte
    Jan 31, 2018 at 14:39
  • Here is another rephrasing of this answer: 1) look for your spatial reference on spatialreference.org; 2) open the OGC WKT format; 3) copy and paste the contents into your prj file; 4) load the shape file.
    – iled
    Apr 19, 2018 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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