[Tilecache] TileCache and The GDAL WMS-C Driver

Christopher Helm CHelm at wapa.gov
Thu Dec 6 12:00:44 EST 2007


Thanks for the response. I was able to get it working by specifying an outsize in the gdal_translate call. My system was trying to create an image that was 268435456 by 134217728 (a little too big). So now everything works for the "basic" layer in my local tilecache. But I'm not understanding where the SizeX and SizeY (268435456 and 134217728, respectively) are coming from in the GDAL XML file. Is there an intuitive way to compute these for a given bounding box?

If so, I have a box of:

<UpperLeftX>-111.27814</UpperLeftX>
<UpperLeftY>45.55317</UpperLeftY>
<LowerRightX>-94.60116</LowerRightX>
<LowerRightY>36.43102</LowerRightY>

I think that the errors Im getting from gdal_translate are stemming from not having the appropriate SizeX and SizeY defined. The errors are:

>> gdal_translate -outsize 512 512 -of PNG test.xml test.png

Input file size is 268435456, 134217728

ERROR 4: `/vsimem/wms/0x8bcb6d8/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
ERROR 4: `/vsimem/wms/0x8bcaf58/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 1024, Y offset 512
ERROR 4: `/vsimem/wms/0x8bc5a40/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
ERROR 4: `/vsimem/wms/0x8bcaf58/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 1024, Y offset 512
ERROR 4: `/vsimem/wms/0x8bc9a48/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
ERROR 4: `/vsimem/wms/0x8bcaf58/wmsresult.dat' not recognised as a supported file format.

ERROR 1: GDALWMS: Unable to open downloaded block.
ERROR 1: GDALWMS: ReadBlockFromFile failed.
ERROR 1: IReadBlock failed at X offset 1024, Y offset 512
libpng error: No IDATs written into file
Segmentation fault


And test.xml looks like:

<GDAL_WMS>
    <Service name="WMS">
        <Version>1</Version>
        <ServerUrl>http://my_server/cgi-bin/tilecache-1.9/tilecache.cgi?</ServerUrl>
        <Layers>test_layer</Layers>
    </Service>
    <DataWindow>
        <UpperLeftX>-111.27814</UpperLeftX>
        <UpperLeftY>45.55317</UpperLeftY>
        <LowerRightX>-94.60116</LowerRightX>
        <LowerRightY>36.43102</LowerRightY>
        <SizeX>268435456</SizeX>
        <SizeY>134217728</SizeY>
        <TileLevel>19</TileLevel>
    </DataWindow>
    <Projection>EPSG:4326</Projection>
    <OverviewCount>19</OverviewCount>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
</GDAL_WMS>


Thanks for your help.


>>> Christopher Schmidt <crschmidt at metacarta.com> 12/5/2007 11:19 PM >>>
On Mon, Dec 03, 2007 at 03:05:22PM -0700, Christopher Helm wrote:
> If I issue gdalinfo on this file it reads it successfully (just as it does for the WMS example), but trying to access the file via any other route (ie gdal_translate) breaks with:
> 
> 0ERROR 1: GDALWMS: Unable to download block 0, 0 (http://labs.metacarta.com/wms-c/Basic.py?request=GetMap&version=1.1.1&layers=basic&styles=&srs=EPSG:4326&format=image/jpeg&width=1024&height=1024&bbox=-180.000000,-90.000000,-143.136000,-53.136000). HTTP status code: 404
> ERROR 1: IReadBlock failed at X offset 0, Y offset 0
> ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

What call are you using to generate this? (Are you *sure* you didn't
change anything in the .xml file?)

I just tested this, and I was able to files of all kinds of odd shapes
and sizes:

crschmidt at hypercube:~/gdal$ GDAL_DATA=data ./apps/gdal_translate
-projwin -72 43 -71 42 -outsize 512 512 -of PNG test.xml test.png
Input file size is 268435456, 134217728
Computed -srcwin 80530636 35045740 745654 745654 from projected window.
0...10...20...30...40...50...60...70...80...90...100 - done.

This is using an exact copy of the XML you sent to the list as an XML
file to load against.

Can you share the GDAL_TRANSLATE function that is failing for you?

Regards, 
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list