[Gdal-dev] VRT Dataset problem

Chris Hodgson chodgson at refractions.net
Wed Jul 6 18:00:21 EDT 2005


I'm trying to write a VRT file which tiles several images together - 
each image is a google maps tile :)

I think my problem is that I need to define the color table for the 
vrtrasterband since I have defined it as "palette" ColorInterp. However, 
the individual tile images do not have identical color palettes (though 
I suspect they have very nearly the same colors, just at different table 
  indexes). Is there a way, with a vrt file, to tell gdal to map the 
colors from the table into a normal RGB colorspace?

Anyways, the symptom is that when I do a galinfo on the vrt file, I get 
a segfault:

$ gdalinfo test.vrt
Driver: VRT/Virtual Raster
Size is 512, 512
Coordinate System is `'
Origin = (0.000000,0.000000)
Pixel Size = (0.35156250,0.17578125)
Corner Coordinates:
Upper Left  (   0.0000000,   0.0000000)
Lower Left  (   0.0000000,  90.0000000)
Upper Right ( 180.0000000,   0.0000000)
Lower Right ( 180.0000000,  90.0000000)
Center      (  90.0000000,  45.0000000)
Band 1 Block=128x128 Type=Byte, ColorInterp=Palette
Segmentation fault


My tiles look like this (yes they have unusual names):

$ gdalinfo mt_v=w2.4\&x=1\&y=1\&zoom=15
Driver: GIF/Graphics Interchange Format (.gif)
Size is 256, 256
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  256.0)
Upper Right (  256.0,    0.0)
Lower Right (  256.0,  256.0)
Center      (  128.0,  128.0)
Band 1 Block=256x1 Type=Byte, ColorInterp=Palette
   NoData Value=144
   Color Table (RGB with 256 entries)
     0: 242,239,233,255
     1: 153,179,204,255
.....

My VRT file looks like this (essentially created by hand):

<VRTDataset rasterXSize="512" rasterYSize="512">
  <GeoTransform>0, 0.3515625, 0.0, 0, 0.0, 0.17578125</GeoTransform>
  <VRTRasterBand dataType="Byte" band="1">
   <ColorInterp>Palette</ColorInterp>
   <SimpleSource>
    <SourceFilename 
relativeToVRT="1">mt_v=w2.4&amp;x=0&amp;y=0&amp;zoom=15</SourceFilename>
    <SourceBand>1</SourceBand>
    <SrcRect xOff="0" yOff="0" xSize="256" ySize="256"/>
    <DstRect xOff="0" yOff="0" xSize="256" ySize="256"/>
   </SimpleSource>
   <SimpleSource>
    <SourceFilename 
relativeToVRT="1">mt_v=w2.4&amp;x=0&amp;y=1&amp;zoom=15</SourceFilename>
    <SourceBand>1</SourceBand>
    <SrcRect xOff="0" yOff="0" xSize="256" ySize="256"/>
    <DstRect xOff="0" yOff="256" xSize="256" ySize="256"/>
   </SimpleSource>
   <SimpleSource>
    <SourceFilename 
relativeToVRT="1">mt_v=w2.4&amp;x=1&amp;y=0&amp;zoom=15</SourceFilename>
    <SourceBand>1</SourceBand>
    <SrcRect xOff="0" yOff="0" xSize="256" ySize="256"/>
    <DstRect xOff="256" yOff="0" xSize="256" ySize="256"/>
   </SimpleSource>
   <SimpleSource>
    <SourceFilename 
relativeToVRT="1">mt_v=w2.4&amp;x=1&amp;y=1&amp;zoom=15</SourceFilename>
    <SourceBand>1</SourceBand>
    <SrcRect xOff="0" yOff="0" xSize="256" ySize="256"/>
    <DstRect xOff="256" yOff="256" xSize="256" ySize="256"/>
   </SimpleSource>
  </VRTRasterBand>
</VRTDataset>




More information about the Gdal-dev mailing list