Bug report #12945

Oblique mercator projection missing +no_uoff in srs.db

Added by Alex Cobb about 9 years ago. Updated over 6 years ago.

Category:Projection Support
Affected QGIS version:master Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:21025


The proj4 text for the oblique mercator projection GDBD2009 (EPSG 5247) is missing the parameter +no_uoff in srs.db. The +no_uoff was also missing in earlier versions of GDAL and SpatiaLite but now seems to be fixed in both. I can get correct behaviour for this CRS by creating a custom CRS in the QGIS GUI with +no_uoff added.

This seems to be related to an earlier bug (#1196) - it sounded like that was fixable by regenerating srs.db using crssync (?). Is this something I can / should do myself? I have been building QGIS from source, rather than using the Fedora-distributed RPM.

Here is the proj4 text in QGIS version 2.9.0-Master, code revision aa6db0e

$ echo 'select srid, description, parameters from tbl_srs where srid=5247;' | sqlite3 resources/srs.db 
5247|GDBD2009 / Brunei BRSO|+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31580995 +k=0.99984 +x_0=0 +y_0=0 +gamma=53.13010236111111 +ellps=GRS80 +units=m +no_defs

and here it is in GDAL:
gdalsrsinfo --version
GDAL 2.1.0dev, released 2015/99/99
$ gdalsrsinfo 'EPSG:5247'

PROJ.4 : '+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31580995 +k=0.99984 +x_0=0 +y_0=0 +no_uoff +gamma=53.13010236111111 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs '

and in SpatiaLite 4.2.0:
sqlite> .load mod_spatialite
sqlite> select spatialite_version();
sqlite> select InitSpatialMetaData();
sqlite> select srid, ref_sys_name, proj4text from spatial_ref_sys where srid=5247;
5247|GDBD2009 / Brunei BRSO|+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31580995 +k=0.99984 +x_0=0 +y_0=0 +no_uoff +gamma=53.13010236111111 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

cs2cs also works correctly with this CRS in PROJ.4 4.8.0 (PROJ.4 claims that +no_uoff is not used, but it is):

$ echo 114.352966 4.359395 | cs2cs -v +init=epsg:4326 +to +init=epsg:5247
# ---- From Coordinate System ----
#Lat/long (Geodetic alias)
# +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
# +towgs84=0,0,0
# ---- To Coordinate System ----
#Oblique Mercator
#    Cyl, Sph&Ell no_rot
#    alpha= [gamma=] [no_off] lonc= or
#     lon_1= lat_1= lon_2= lat_2=
# +init=epsg:5247 +proj=omerc +lat_0=4 +lonc=115 +alpha=53.31580995 +k=0.99984
# +x_0=0 +y_0=0 +gamma=53.13010236111111 +ellps=GRS80 +units=m +no_defs
#--- following specified but NOT used
# +no_uoff
518581.10    482422.80 0.00

Tested on QGIS version 2.9.0-Master, code revision aa6db0e, compiled against GDAL/OGR 2.1.0dev, running against GDAL/OGR 2.1.0dev, compiled against GEOS 3.4.2-CAPI-1.8.2, running against GEOS 3.4.2-CAPI-1.8.2 r3921, PROJ.4 Version 480


#1 Updated by Giovanni Manghi about 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#2 Updated by Alex Cobb over 6 years ago

To answer my own question: It seems that srs.db is fairly out of date by default, the last update was in February 2014. This issue and related ones can be worked around by running crssync (on 64-bit Fedora, /usr/lib64/qgis/crssync) with no arguments. Updating srs.db is included as a post install / post-upgrade hook on Debian, but not in the Fedora package.

It seems to me that running crssync on srs.db could be made part of build / install, or the need to run it after install should be documented in the QGIS sources and / or on the website. I will file a separate bug for this.

#3 Updated by Alex Cobb over 6 years ago

I think this bug can be closed, I have opened #17993 regarding better documentation or automatic updating with crssync.

#4 Updated by Jürgen Fischer over 6 years ago

  • Resolution set to worksforme
  • Description updated (diff)
  • Status changed from Open to Closed

Also available in: Atom PDF