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

synchronize QGIS' SRS definitions with GDAL's 1.8.0 SRS database #13704

Closed
qgib opened this issue Mar 20, 2011 · 11 comments
Closed

synchronize QGIS' SRS definitions with GDAL's 1.8.0 SRS database #13704

qgib opened this issue Mar 20, 2011 · 11 comments
Labels
Feature Request Projections/Transformations Related to coordinate reference systems or coordinate transformation
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Mar 20, 2011

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)
Original Redmine Issue: 3645

Redmine category:projection_support
Assignee: Jürgen Fischer


Some QGIS´ SRS definitions are missing towgs84 values, including UTM Indian 1960 48N, resulting in misalignment of mixed-datum layers with projects with on the on the fly reprojection set.

Folks from the #gdal IRC channel said QGIS should update/synchronize it's SRS definition database with GDAL's 1.8.0 SRS database.

I can confirm that creating a custom SRS using GDAL's version of the UTM Indian 1960 48N definition (same as QGIS except QGIS misses the +towgs84 value) fixed all of my reprojection problems.

(see a bunch of screenshots with misaligned vectors from this now invalid ticket: http://trac.osgeo.org/qgis/ticket/3632)

Pasting some useful bits from a discussion in #gdal:
EvenR, what would explain a difference in reprojection between qgis and gdal?
it might depend on the GDAL version you have and the definition that QGIS uses for EPSG:3148. GDAL 1.8.0 has a TOWGS84[198,881,317,0,0,0,0] for EPSG:3148.
you have to check what SRS definition qgis uses for EPSG:3148. I suspect it has not the TOWGS84 shift
+proj=utm +zone=48 +a=6377276.345 +b=6356075.41314024 +units=m +no_defs
indeed, there's no towgs84 in the qgis definition
it could be appropriate that it synchronizes its SRS definitions (for that one, and also for others) with GDAL 1.8.0 SRS database
in GDAL 1.8.0, a lot of TOWGS84 have been added by taking into account the preferred datum shift from the EPSG database
omg, it actually works
I created a custom crs using the indian 1960 48n definition and adding the +towgs84 bit, et voila
you can point to http://trac.osgeo.org/gdal/changeset/18978 which is the changeset during GDAL 1.8.0 where the datum shift logic has been improved



Related issue(s): #14023 (relates)
Redmine related issue(s): 4037


@qgib
Copy link
Contributor Author

qgib commented Mar 21, 2011

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


I created a tiny script to a) flag the srs.db's tbl_srs 'parameters' column needing updates and b) ouput the sql update query.

The script compared qgis' srs.db against the proj4's EPSG file (http://trac.osgeo.org/proj/browser/trunk/proj/nad/epsg), the latter already synched with GDAL.

2157 SRS parameters needed update (mostly +towgs84 additions).


  • status_id was changed from Open to In Progress

@qgib
Copy link
Contributor Author

qgib commented Mar 22, 2011

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


I've attached the script used to come up with the sql update statements. It's unfortunately not in python but in php.

@qgib
Copy link
Contributor Author

qgib commented Mar 23, 2011

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


the attached patch updates our db with the parameters of PROJ. This could be run on automatically at installation (using the python API).

Unfortunately there currently is a bug in PROJ that causes the routine to crash after fetching 16 projections ("PROJ #10159":http://trac.osgeo.org/proj/ticket/100).

@qgib
Copy link
Contributor Author

qgib commented Mar 27, 2011

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


jef, as mentioned over irc, the updated srs.db you applied in changeset 15584 (http://trac.osgeo.org/qgis/changeset/15584) doesn't appear to have the latest definition for many datums (based in gdal 1.8).

To give one example, the epsg 3148 (indian 1960 48n) in your srs.db is:
+proj=utm +zone=48 +a=6377276.345 +b=6356075.41314024 +units=m +no_defs

It's missing the +towgs84 declaration, found in latest gdal 1.8 and proj.4 epsg file:
+proj=utm +zone=48 +a=6377276.345 +b=6356075.41314024 +towgs84=198,881,317,0,0,0,0 +units=m +no_defs

Without the +towgs84 declaration, on the fly reprojection of wgs84 & epsg 3148 datums have a +450m margin difference. It also affects coverting layers from one datum to the other using qgis' built-in "save as..." function.

You based your updated srs.db on proj 4.7.0 (http://trac.osgeo.org/proj/browser/tags/4.7.0/proj/nad/epsg) which the devs synched with latest gdal definitions afterwards (http://trac.osgeo.org/proj/browser/trunk/proj/nad/epsg).

Would it be possible to ship 1.7 with a srs.db synched with gdal latest datum definitions?

@qgib
Copy link
Contributor Author

qgib commented Mar 27, 2011

Author Name: Maciej Sieczka - (Maciej Sieczka -)


Replying to [comment:4 nirvn]:

Would it be possible to ship 1.7 with a srs.db synched with gdal latest datum definitions?

Couple of months ago I have written a Shell script which creates a new srs.db based on the output of localy installed PROJ.4 and GDAL: http://trac.osgeo.org/qgis/browser/trunk/qgis/scripts/qgis_srs.sh.

It was used once to update the srs.db in SVN, about a year ago. After that, a few manual edits have been done on srs.db too.

The script would not retain those manual non-GDAL-derived SRS definitions. They would need to be taken care of. I guess that as of current trunk SVN these are srs_id>=3646.

@qgib
Copy link
Contributor Author

qgib commented Mar 28, 2011

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


jef, kudos for http://trac.osgeo.org/qgis/changeset/15617

@qgib
Copy link
Contributor Author

qgib commented Apr 6, 2011

Author Name: Paolo Cavallini (@pcav)


Now EPSG:3003 is defined in QGIS as:

+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl
+towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m +no_defs

instead of the old:

+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl
+no_defs

Similarly for EPSG:3004.

The corrections have been already inserted as fake EPSG codes:

40000
+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl
+units=m +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +no_defs
40001
+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl
+units=m +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +no_defs
40002
+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl
+units=m +towgs84=-168.6,-34.0,38.6,-0.374,-0.679,-1.379,-9.48 +no_defs
40003
+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl
+units=m +towgs84=-50.2,-50.4,84.8,-0.690,-2.012,0.459,-28.08 +no_defs

So the fake codes 40000 and 40001 are now duplicates, and should be
removed. 40002 and 40002 are useful, as they define ad hoc datum for
Sardinia and Sicily.

@qgib
Copy link
Contributor Author

qgib commented Apr 6, 2011

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


Replying to [comment:7 pcav]:

So the fake codes 40000 and 40001 are now duplicates, and should be
removed. 40002 and 40002 are useful, as they define ad hoc datum for
Sardinia and Sicily.

The EPGS numbers are prefered. Removing the definitions might break layers that are assigned to one of those.

@qgib
Copy link
Contributor Author

qgib commented Apr 6, 2011

Author Name: Jeremy Palmer (@palmerj)


The patch from http://trac.osgeo.org/qgis/ticket/3136 have also been reverted by this update from gdal. Can we re-apply them?

@qgib
Copy link
Contributor Author

qgib commented Apr 23, 2011

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


  • status_id was changed from In Progress to Open

@qgib
Copy link
Contributor Author

qgib commented May 5, 2011

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


applied in a9aafd0


  • resolution was configured as fixed
  • status_id was changed from Open to Closed

@qgib qgib added Feature Request Projections/Transformations Related to coordinate reference systems or coordinate transformation labels May 24, 2019
@qgib qgib added this to the Version 1.7.0 milestone 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
Feature Request Projections/Transformations Related to coordinate reference systems or coordinate transformation
Projects
None yet
Development

No branches or pull requests

1 participant