[gdal-dev] MapServer using GDAL_WMS to access TileCache layer

Roger André randre at gmail.com
Mon Mar 23 16:18:16 EDT 2009


Hi All,

I've created a TileCache layer that's being used to overlay tiles in a
Google Maps page.  That's working just fine, but I would also like to
access this layer via a MapServer WMS call as well.  I have tried to
setup a GDAL_WMS file that can read the TileCache layer, but am
getting "IReadBlock failed" errors when I try to run gdal_translate on
it, or try to view the layer in a MapServer map.

Below are the pertinent details of my configuration.

TileCache layer:
-----------------------
[20m_global]
type=MapServerLayer
mapfile=/var/www/mapfiles/20m_global/20m_global.map
#url=http://10.10.40.152/cgi-bin/mapserv?map=/var/www/mapfiles/20m_global/20m_global.map
metaTile=true
metaSize=2,2
metaBuffer=0,500
layers=imagery
spherical_mercator=true
srs=EPSG:900913

GDAL_WMS xml file:
------------------------------
<GDAL_WMS>
<Service name="TileService">
<!--<ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>-->
<ServerUrl>http://10.10.10.143/cgi-bin/tilecache-2.04/tilecache.cgi/1.0.0/v2_80m_global/{Z}/{X}/{Y}.png</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>11</TileLevel>
<TileCountX>1</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:900913</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>3</BandsCount>
<Cache/>
</GDAL_WMS>

gdalinfo output:
---------------------
$ gdalinfo tilecache.xml
Driver: WMS/OGC Web Map Service
Files: tilecache.xml
Size is 524288, 524288
Coordinate System is:
PROJCS["Google Maps Global Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_2SP"],
    PARAMETER["standard_parallel_1",0],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["Meter",1],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext
+no_defs"],
    AUTHORITY["EPSG","900913"]]
Origin = (-20037508.339999999850988,20037508.339999999850988)
Pixel Size = (76.437028274536132,-76.437028274536132)
Corner Coordinates:
Upper Left  (-20037508.340,20037508.340) (180d 0'0.00"W, 85d 3'4.06"N)
Lower Left  (-20037508.340,-20037508.340) (180d 0'0.00"W, 85d 3'4.06"S)
Upper Right (20037508.340,20037508.340) (180d 0'0.00"E, 85d 3'4.06"N)
Lower Right (20037508.340,-20037508.340) (180d 0'0.00"E, 85d 3'4.06"S)
Center      (   0.0000000,   0.0000000) (  0d 0'0.01"E,  0d 0'0.00"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined
  Overviews: 262144x262144, 131072x131072, 65536x65536, 32768x32768,
16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512,
256x256
Band 2 Block=256x256 Type=Byte, ColorInterp=Undefined
  Overviews: 262144x262144, 131072x131072, 65536x65536, 32768x32768,
16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512,
256x256
Band 3 Block=256x256 Type=Byte, ColorInterp=Undefined
  Overviews: 262144x262144, 131072x131072, 65536x65536, 32768x32768,
16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512,
256x256

gdal_translate error:
----------------------------
$ gdal_translate -outsize 1% 1% tilecache.xml test.tif
Input file size is 524288, 524288
0ERROR 4: `/vsimem/wms/0x8503470/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 4: `/vsimem/wms/0x809dc08/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

MapServer error:
-----------------------
msDrawMap(): Image handling error. Failed to draw layer named
'imagery'. IReadBlock failed at X offset 1442, Y offset 607: Unable to
access file. GDALRasterIO() failed: drawGDAL()

If you see anything that jumps out at you as being incorrect, I'd love
to hear from you.

Thanks,

Roger


More information about the gdal-dev mailing list