Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong projections for custom CRS #14923

Closed
qgib opened this issue Mar 14, 2012 · 4 comments
Closed

Wrong projections for custom CRS #14923

qgib opened this issue Mar 14, 2012 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Projections/Transformations Related to coordinate reference systems or coordinate transformation

Comments

@qgib
Copy link
Contributor

qgib commented Mar 14, 2012

Author Name: zirneklitis - (zirneklitis -)
Original Redmine Issue: 5176
Affected QGIS version: master
Redmine category:projection_support


+Background:+

Any unrecognised CRS from maps are registered as a new Custom CRS with a new ID (starting from 100000). This information is kept somewhere in QGIS configuration files.
E.g. – opening the example shapefile “sample_points” will add a new custom CRS. Let's suppose that the first free ID is 100001. Let's create a new project with this shape file layer. The information added to the QGIS project file will be as follows:
@..
./sample_points.shp
sample_points


+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs
100001
0
USER:100001
* Ģenerēts CRS (+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs)
tmerc
GRS80
false


..
@

+The Problem+

Let's suppose we send this project (created in the first PC) file and shape file to another user. The second user uses the second PC. Let's suppose the other user is very active one. :) He has used several maps with different unrecognised CRS. So custom CRS with following IDs are presented in the system: 100000, 100001, 100002, 100003. And, of-course, 100001 does not mean the same CRS as it was on the first PC.
Now guess which projection definition will be used in the second PC. :( The Quantum GIS is projecting the sample_points using definition from the the second PC not from the project file or shape file itself.

+Repeatability+

100 %. Tested versions: 1.7.1 (Ubuntu 9.10), 1.7.4 (OSGeo4W) , Master (OSGeo4W and compiled from source for Fedora 14 x 64).
It's easy to reproduce this bug with any QGIS version. Add as a new layer the attached shape-file. A new custom CRS should be added. Save the project. Close QGIS. Open QGIS. Go to CRS customisation dialogue (Setting/Custom CRS). Change any parameters of the newly created projection, e.g., y_0=0 to y_0=400. Open the saved project. The layer “sample_points” is now moved 400 meters towards north.

+Possible bug-fix.+

In project files for custom CRS the following information should not be saved: and . At least, must be with higher priority then the and .


@qgib
Copy link
Contributor Author

qgib commented Mar 14, 2012

Author Name: zirneklitis - (zirneklitis -)


Let's suppose an another user uses the third PC. He has never used unrecognised CRS and he has no customised CRS. If the above QGIS project is opened on this third PC, the result is confusing. Now the EPSG:2100 - GGRS87 / Greek Grid is used for the “sample_points".

@qgib
Copy link
Contributor Author

qgib commented Mar 19, 2012

Author Name: Brian Freed (@bfreed)


I can confirm this issue. Wish I'd seen this before I spend my morning tracking it down! Not only is this a display problem, but however QGIS writes to Spatialite, it's not tripping the CRS trigger. In other words, we have a field template that should use a customized reference system (project spans 2 UTM zones, and accuracy not super critical). This custom CRS is in the Spatialite db as srid=99001, and the lines table is defined as such. But last week, on a different user's laptop, when he grabbed the template, QGIS matched the unknown CRS with "NAD83 Pennsylvania State Plane South." The user did the whole design, and QGIS happily saved it out, and Spatialite happily accepted it, but the coordinates written into the database are indeed PA State Plane values, not the 99001 values.
[solution: discard geometry column, setsrid=2271, transform to 99001, recovergeometrycolumn]

zirneklitis:
2 bits I can add to help with a workaround for now:

  1. (Windows only) the user CRS are stored in an SQLite database - C:\Documents and Settings\UserName\.qgis\qgis.db, the tbl_srs table.
  2. Opening the .qgs file in a text editor and deleting all the tags for your project and any affected layer(s) except for the line(s) will prevent QGIS from linking the unknown CRS with whatever "100000" happens to be.

With the user-generated 10000x tags deleted, opening the file under a different user name or on a different pc results in QGIS creating a new CRS that matches the Proj4 parameters.

It does seem like if it sees a custom CRS that exactly matches the Proj4 parameters, it will use it. That's good, as I was afraid of making a new 10000x number every time I open a file.

@qgib
Copy link
Contributor Author

qgib commented Mar 20, 2012

Author Name: Gavin Fleming (@gubuntu)


I can confirm this issue. It's well-described above. It has been around since at least June 2011. Layers shouldn't be saved in the .qgs file referencing a CRS ID unless it is a standard / provided CRS ID. Custom or generated CRS's should be referenced by full proj4 string.

@qgib
Copy link
Contributor Author

qgib commented May 18, 2012

Author Name: Jürgen Fischer (@jef-n)


Fixed in changeset "56808d91a12ddb33b1d173778f3b47b136876093".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Projections/Transformations Related to coordinate reference systems or coordinate transformation labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Projections/Transformations Related to coordinate reference systems or coordinate transformation
Projects
None yet
Development

No branches or pull requests

1 participant