[Gdal-dev] Newbie question about Memory driver

Black, Jerry BlackJ at mar.dfo-mpo.gc.ca
Fri Dec 22 10:54:35 EST 2006


Hi,

I'm a newbie, and have a question that stems from my desire to perform the
following:

	gdal_translate from a source data file into a memory driver and then
	gdal_warp from that memory driver into a 2nd memory driver 

Writing code to essentially call copies of these routines, from my own code
works fine when the execution is:

	gdal_translate from a source data file into a temporary file and
then
	gdal_warp from that file into a 2nd temporary file (at which point
my code can grab the raster from the 2nd file)

When attempting to use memory drivers, the gdal_warp code quite validly
complains that there is not affine transformation (note this being done in
C++ so the memory address is valid between these calls).

Translating file:
gdal_translate -of MEM -co PHOTOMETRIC=RGB -co INTERLEAVE=PIXEL -ot Byte
-outsize 1226 574 -projwin -130.000000 52.000000 -113.883258 47.000000
c:/world-topo-bathy-200406-3x86400x43200.ecw
MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte
Input file size is 86400, 43200

Warping file:
Gdalwarp -s_srs EPSG:4326 -t_srs +proj=merc +lon_0=-121.942w -ts 613 287 -wt
Byte
MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte
c:/world-topo-bathy-200406-3x86400x43200_MERC.TIF

Unable to compute a transformation between pixel/line
and georeferenced coordinates for
MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte.
There is no affine transformation and no GCPs.

As the Memory driver only stores the actual pixels, I can see why the affine
transformation is missing when calling gdalwarp. Either I'm missing a
parameter for gdalwarp that would enable this, or is there another memory
driver example / or approach available that encapsulates all of the
projection info into the memory structure?

I suspect the only solution is to tease out the relevant sections of
gdaltranlate and gdalwarp and pass the dataset between them.


The original ecw file has EPSG:4326 imbedded in it.

gdalinfo
c:/world-topo-bathy-200406-3x86400x43200.ecw
Driver: ECW/ERMapper Compressed Wavelets
Size is 86400, 43200
Coordinate System is:
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"]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00416667,-0.00416667)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0'0.00"W, 90d 0'0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0'0.00"E, 90d 0'0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00"E, 90d 0'0.00"S)
Center      (  -0.0000000,   0.0000000) (  0d 0'0.00"W,  0d 0'0.00"N)
Band 1 Block=86400x1 Type=Byte, ColorInterp=Red
  Overviews: arbitrary
Band 2 Block=86400x1 Type=Byte, ColorInterp=Green
  Overviews: arbitrary
Band 3 Block=86400x1 Type=Byte, ColorInterp=Blue
  Overviews: arbitrary

Thanks

Jerry Black	
Bedford Institute of Oceanography 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061222/edf1c5d3/attachment.html


More information about the Gdal-dev mailing list