Opened 13 years ago
Closed 13 years ago
#3586 closed patch (fixed)
use authid instead of proj.4 strings
Reported by: | jef | Owned by: | jef |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.7.0 |
Component: | Projection Support | Version: | |
Keywords: | Cc: | ||
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
Currently we try to use the proj.4 strings to store references to coordinate systems (eg. for the default project crs). Unfortunately the proj.4 string isn't unique in our database:
sqlite> select count(*),parameters from tbl_srs group by parameters order by count(*) desc limit 10; 54|+proj=longlat +ellps=intl +no_defs 27|+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs 21|+proj=longlat +ellps=clrk80 +no_defs 17|+proj=longlat +ellps=bessel +no_defs 15|+proj=longlat +ellps=clrk66 +no_defs 13|+proj=longlat +a=6378249.2 +b=6356515 +no_defs 11|+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs 9|+proj=longlat +ellps=GRS80 +no_defs 9|+proj=longlat +ellps=krass +no_defs 9|+proj=tmerc +lat_0=0 +lon_0=105 +k=1 +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs sqlite> select auth_name,auth_id,description,parameters from tbl_srs where parameters='+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs' limit 1; EPSG|4148|Hartebeesthoek94|+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
So selecting 'EPSG:4326' as default CRS results in 'EPSG:4148 - Hartebeesthoek94' - which obviously is irritating.
The attached patch switches to the use of authid instead of proj.4 strings. Any objections to commit it for 1.7?
Attachments (2)
Change History (8)
by , 13 years ago
follow-up: 3 comment:2 by , 13 years ago
I've slightly modified your patch:
- Also save the authid to QSettings, not only read ;-) (qgsoptions.cpp 642 and 646)
- Use layerDefaultCrs Qsettings key instead of misleading defaultCrs. As the patch breaks this setting anyway, I take a opportunity to clean up a bit. (qgsoptions.cpp 191 and 642; qgisapp.cpp 361)
By the way. Seems it works not only with epsg ids. Is the note in api doc out of date? http://doc.qgis.org/head/classQgsCoordinateReferenceSystem.html#5789a11684af1415ffc74d7ce9ab91f0
comment:3 by , 13 years ago
Replying to borysiasty:
- Also save the authid to QSettings, not only read ;-) (qgsoptions.cpp 642 and 646)
if you insist ;)
By the way. Seems it works not only with epsg ids. Is the note in api doc out of date? http://doc.qgis.org/head/classQgsCoordinateReferenceSystem.html#5789a11684af1415ffc74d7ce9ab91f0
Oh, yes. That note was probably already there, when we added the auth_name column to tbl_srs...
follow-up: 6 comment:5 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
But what with project files? Both authid and proj string are saved.
JEF, could you please confirm that authid is higher prriority and hopefully close the ticket again?
comment:6 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Replying to borysiasty:
But what with project files? Both authid and proj string are saved.
JEF, could you please confirm that authid is higher prriority and hopefully close the ticket again?
looks like it. order is authid, epsg, proj.4 and as last resort a CRS initialized with all the values from the node. Otherwise we should have hit the 'Hartebeesthoek94' problem earlier...
use authid instead of proj.4 strings to identify CRS