Bug report #17138

wrong SRS identification of shapefile

Added by Tobias Wendorff over 6 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Projection Support
Affected QGIS version:2.18.12 Regression?:No
Operating System:Windows 7, 64 bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:25037

Description

I often have problems with QGIS getting the right SRS out of shapefiles. Since I've got a bunch of bad results now, I'm going to write this bug report :)
Let's use OpenData datasets of the Federal Agency for Cartography and Geodesy in Germany for this.

You can get them in many projections, I'll use these:
  1. UTM32 on GRS80 (EPSG: 25832): http://www.geodatenzentrum.de/auftrag1/archiv/vektor/vg250_ebenen/2017/vg250_2017-01-01.utm32s.shape.ebenen.zip
  2. UTM32 on WGS84 (EPSG: 32632): http://www.geodatenzentrum.de/auftrag1/archiv/vektor/vg250_ebenen/2017/vg250_2017-01-01.utm32w.shape.ebenen.zip
  3. WGS84 (EPSG: 4326) : http://www.geodatenzentrum.de/auftrag1/archiv/vektor/vg250_ebenen/2017/vg250_2017-01-01.geo84.shape.ebenen.zip
These are the PRJ files:
  1. PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
  2. PROJCS["WGS_1984_UTM_Zone_32Nz",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",32500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",9],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0],UNIT["Meter",1]]
  3. GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
These are the results of loading the files in QGIS:
  1. EPSG:3044 [wrong]
  2. USER: 1000002 [very wrong]
  3. EPSG:4326 [correct]

EPSG:3044 actually looks like this:

PROJCS["ETRS89 / ETRS-TM32",GEOGCS["ETRS89",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]

Since I know about EPSG-codes and projections, I'm able to correct them on export. My co-workers don't have a clue and store it in the wrong SRS. This will result into warning messages on intersections and other GIS tasks.

History

#1 Updated by Tobias Wendorff over 6 years ago

Correction: Ignore "2" please. I missed its +x_0=32500000, which makes it custom of course. There's leading 32 for ETRS89 only, not for WGS84. EPSG codes are a mess :(

#2 Updated by Gerhard Spieles over 6 years ago

The same problem in georeferencer. Instead of SRS 25832, QGIS produce SRS 3044.
See #13398

#4 Updated by Tobias Wendorff over 6 years ago

Returned info: it's not a Proj4 error...

#5 Updated by Tobias Wendorff over 6 years ago

I just got informed that EPSG:25833 (eastern part of German) is interpreted as EPSG:3006. In Europe, more and more cadastral offices and corporations are switching from ArcGIS & MapInfo to QGIS. Since the SRSs between EPSG:25828 and EPSG:25837 are the official ones, many users will run into problems.

Dear QGIS-guys, please fix this bug. An easy work-around is to parse gdalsrsinfo's output. It identifies SRSs from PRJ correctly.

An example (EPSG:25833), which gets read as 3006:
https://www.statistik-berlin-brandenburg.de/opendata/RBS_OD_Wahlgebiete_BTW17.zip

Update 1: The problem has not been fixed in QGIS3. From my point of view, this might be a blocker, since SRS handling is essential for a GIS.

Update 2: EvenR just has dropped me a message: "OSRFindMatches() I added in GDAL trunk a few weeks ago ( http://gdal.org/ogr__srs__api_8h.html#afb64acc80626c9ea0f9ec75017a10169 ) could potentially be of help".

#6 Updated by Tobias Wendorff about 6 years ago

Error is still alive in QGIS3 d48818b492. This really makes trouble working with official data coming from ESRI environment :(

#7 Updated by Robert Nuske about 6 years ago

Having imported data with CRS 25832, which gets magnled to 3044 by QGIS,
one has to pay close attention to switch the CRS back to 25832 during every export.

As far as i understood the only difference between 25832 and 3044 should be the axis ordering (north before east in 3044). Most GIS systems choose to ignore the axis ordering but not all! So it's a real source of concern that qgis assigns a wrong EPSG code to data having a perfectly fine WKT. But it seems to work fine if the prj-file contains a "AUTHORITY["EPSG","25832"]]" line, which is rarely seen in the wild.

#8 Updated by Tobias Wendorff about 6 years ago

Robert Nuske wrote:

As far as i understood the only difference between 25832 and 3044 should be the axis ordering (north before east in 3044). Most GIS systems choose to ignore the axis ordering but not all!

One of the problems is that there are warning if two SRS on geoprocessing to not match. So if a check is run against SRS assignment, 25832 is not equal to 3044 and you'll get a warning, error or the application does an unneeded transformation (I haven't checked QGIS3, but it does on-the-fly transformations).

So it's a real source of concern that qgis assigns a wrong EPSG code to data having a perfectly fine WKT containing even a "AUTHORITY["EPSG","25832"]]" line.

Sure, that's a work-around I've posted on the mailinglist already. I'm actually having a bunch of PRJ files, which used to work on ArcGIS, PostGIS, GDAL and QGIS and I'm exchanging these if needed with a shell-script. But it is difficult to explain this to a normal employee who rarely uses QGIS. This is also an unpleasant bug for users switching from another GIS to QGIS.

When I run a processing script, I always have to check what comes in first and then reassign the SRS. Very unsightly solution.

#9 Updated by Jürgen Fischer over 5 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#10 Updated by Giovanni Manghi about 5 years ago

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

End of life notice: QGIS 2.18 LTR

Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/

QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.

We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4

Most plugins have been either migrated or incorporated into the core QGIS code base.

We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.

You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.

If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.

The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.

Also available in: Atom PDF