[Gdal-dev] How do I make an OGRSpatialReference from this?

Christopher Barker Chris.Barker at noaa.gov
Mon Jul 17 18:09:58 EDT 2006


Hi all,

In the long term, I need to be able to read a variety of geo-referenced 
raster maps, and be able to map lat/long to pixel and back again. I've 
gone through osr_tutorial.html, and been playing around with GDAL, all 
with Python. I can read the images and display them and I can get the 
sample code in the osr tutorial to work. However, for my two test data 
sets, I can't figure out how to set up an OGRSpatialReference.

My first data set is a NOAA Raster Nautical chart (BSB). when I run 
gdalinfo on it, I get:

Driver: BSB/Maptech BSB Nautical Charts
Size is 10877, 9391
Coordinate System is `'
GCP Projection = GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG",7030]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG",6326]],PRIMEM["Greenwich",0,AUTHORITY["EPSG",8901]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG",9108]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG",4326]]
GCP[  0]: Id=GCP_1, Info=
           (248,8558) -> (-89.55,28.7669,0)
GCP[  1]: Id=GCP_2, Info=
           (248,483) -> (-89.55,29.3502,0)
GCP[  2]: Id=GCP_3, Info=
           (10587,483) -> (-88.7,29.3502,0)
.
.
.
<and a bunch more ...>
.
.
.
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 9391.0)
Upper Right (10877.0,    0.0)
Lower Right (10877.0, 9391.0)
Center      ( 5438.5, 4695.5)
Band 1 Block=10877x1 Type=Byte, ColorInterp=Palette
   Color Table (RGB with 12 entries)
     0: 0,0,0,255
.
.
.
It seems that the WKT is defining the datums (data?), but not the 
projection. How do i set the projection? Do I need to calculate it from 
the 50! GCPs?

My other example is a geotiff, dumped out of ESRI ArcMap. Here's what I 
get for that:

Driver: GTiff/GeoTIFF
Size is 644, 526
Coordinate System is `'
Origin = (-95.395352,29.952230)
Pixel Size = (0.00080067,-0.00080067)
Metadata:
   TIFFTAG_XRESOLUTION=96
   TIFFTAG_YRESOLUTION=96
   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Corner Coordinates:
Upper Left  ( -95.3953516,  29.9522296)
Lower Left  ( -95.3953516,  29.5310747)
Upper Right ( -94.8797171,  29.9522296)
Lower Right ( -94.8797171,  29.5310747)
Center      ( -95.1375343,  29.7416522)
Band 1 Block=644x8 Type=Byte, ColorInterp=Red
Band 2 Block=644x8 Type=Byte, ColorInterp=Green
Band 3 Block=644x8 Type=Byte, ColorInterp=Blue


For this one, I don't have a WKT, or anything else I can interpret as a 
datum or projection. I could just interpolate from the corners -- is 
that what I'm supposed to do? Is there a way to create a 
SpatialReference from this data?

As is probably clear, I'm very new to all this!

Thanks,
-Chris






-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Gdal-dev mailing list