[gdal-dev] Adding Datums to GDAL

Pascoe, S (Stephen) S.Pascoe at rl.ac.uk
Fri Jan 18 10:16:26 EST 2008


OK I was showing my naivety with thinking GDAL didn't have EPSG:27700
pre-configured.  Please ignore the the first half of my query.  However,
having reinstalled Proj4 (4.6.0) and gdal-1.5.0, I still have the same
problem:
 
$ gdalwarp -t_srs EPSG:27700 -te -100000 -100000 600000 600000 -ts 400
400 map.tif trans.tif
ERROR 6: Failed to initialize PROJ.4 with `+proj=tmerc +lat_0=49
+lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy
+datum=OSB36 +units=m +no_defs '.

 
map.tif is a global bitmap that has been georeferenced with GCPs:
 
gdalinfo map.tif
Driver: GTiff/GeoTIFF
Files: map.tif
Size is 960, 480
Coordinate System is `'
GCP Projection = GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.2572235629972,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG"
,"6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHOR
ITY["EPSG","4326"]]
GCP[  0]: Id=1, Info=
          (0,0) -> (-180,90,0)
GCP[  1]: Id=2, Info=
          (0,480) -> (-180,-90,0)
GCP[  2]: Id=3, Info=
          (960,0) -> (180,90,0)
GCP[  3]: Id=4, Info=
          (960,480) -> (180,-90,0)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  480.0)
Upper Right (  960.0,    0.0)
Lower Right (  960.0,  480.0)
Center      (  480.0,  240.0)
Band 1 Block=960x2 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=960x2 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=960x2 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=960x2 Type=Byte, ColorInterp=Alpha

 
S.
 
---
Stephen Pascoe  +44 (0)1235 445980
British Atmospheric Data Centre
Rutherford Appleton Laboratory
 


________________________________

From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Pascoe, S
(Stephen)
Sent: 18 January 2008 11:58
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] Adding Datums to GDAL


I am relatively new to GDAL and OpenGIS technology in general to
apologies if this is the wrong forum.
 
I want to use GDAL to transform a EPSG:4326 raster to British National
Grid coordinates (EPSG:27700).  With a bit a bit of googling I found the
WKT for EPSG:27700 and installed it in <gdal-root>/share/epsg.wkt:
 
27700,PROJCS["OSGB 1936 / British National Grid",
        GEOGCS["OSGB 1936",
            DATUM["OSGB_1936",
                SPHEROID["Airy
1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],
                TOWGS84[375,-111,431,0,0,0,0],
                AUTHORITY["EPSG","6277"]],
            PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
            UNIT["DMSH",0.0174532925199433,AUTHORITY["EPSG","9108"]],
            AXIS["Lat",NORTH],
            AXIS["Long",EAST],
            AUTHORITY["EPSG","4277"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",49],
        PARAMETER["central_meridian",-2],
        PARAMETER["scale_factor",0.999601272],
        PARAMETER["false_easting",400000],
        PARAMETER["false_northing",-100000],
        UNIT["metre",1,AUTHORITY["EPSG","9001"]],
        AXIS["E",EAST],
        AXIS["N",NORTH],
        AUTHORITY["EPSG","27700"]]

Tests indicate it is found.  However, when I try to use gdalwarp I get
an error:
 
$ gdalwarp -t_srs EPSG:27700 -te -100000 -100000 600000 600000 -ts 400
400 map.tif trans.tif
ERROR 6: Failed to initialize PROJ.4 with `+proj=tmerc +lat_0=49
+lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy
+datum=OSB36 +units=m +no_defs '.

Guessing that it didn't know what +datum=OSB36 was I tried changing it
to WGS84 and it worked (the proj parameters were taken directly from the
error above):
 
$ gdalwarp -t_srs '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717
+x_0=400000 +y_0=-100000 +ellps=airy +datum=WGS84 +units=m +no_defs' -te
-100000 -100000 600000 600000 -ts 400 400 map.tif trans.tif
 
My question is how do I install the OSGB36 datum into GDAL?  The WKT
above appears to contain parameters for this datum so why is proj_4
failing?
 
Many thanks,
Stephen.
 
 
---
Stephen Pascoe  +44 (0)1235 445980
British Atmospheric Data Centre
Rutherford Appleton Laboratory
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080118/707b026a/attachment.html


More information about the gdal-dev mailing list