[gdal-dev] Re: WMS driver question in spherical mercator

Chris Nicholas chrisgnicholas at att.net
Fri May 21 21:10:00 EDT 2010


NEVER mind! DOH! UPPER-left x y,... (RTFM!) 

thanks again Frank and crew for fantastic SW!
Chris



----- Original Message ----
From: Chris Nicholas <chrisgnicholas at att.net>
To: gdal-dev at lists.osgeo.org
Sent: Fri, May 21, 2010 6:02:43 PM
Subject: WMS driver question in spherical mercator

greetings - first and foremost, as usual, I was pleasantly surprised to find more neat stuff when I went looking for it in GDAL. :-)

I'm trying to use this newfangled spherical mercator projection, EPSG:3857, with Mapnik, but want to manage all the raster foo in good old mapserver, with a TINDEX.

So, I have a WMS that works great, with URLs like: 

http://rasterfoo//cgi-bin/mapserv?map=/Users/cgn/public_html/maps/terrain_info/terrain.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=1001861,-5,1113192,111325&SRS=EPSG:3857&WIDTH=512&HEIGHT=512&LAYERS=SRTM_processed_warped&STYLES=&FORMAT=image/png&DPI=72&TRANSPARENT=TRUE ...

Now, I'm trying to make a nice GDAL source for it, but keep going out of bounds on srcwin  :-( 

Comment/suggestions/RTFMs welcomed...

thanks!
Chris
-------------------------------------------------------

rasterfoo-> cat test.xml

<GDAL_WMS>
<Service name="WMS">
<Version>1.1.1</Version>
<ServerUrl>http://rasterfoo/cgi-bin/mapserv?map=/Users/cgn/public_html/maps/terrain_info/terrain2.map&version=1.1.1&service=WMS</ServerUrl>
<SRS>EPSG:3857</SRS>
<ImageFormat>image/png</ImageFormat>
<Layers>SRTM_processed_warped</Layers>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<SizeY>40075016</SizeY>
<SizeX>40075016.857</SizeX>
</DataWindow>
<Projection>EPSG:3857</Projection>
<BandsCount>4</BandsCount>
<ClampRequests>false</ClampRequests>
</GDAL_WMS>

-----------------------------

when I try to make a similar request via gral_translate,  ... :-( 

gdal_translate -of PNG -projwin 1001861 -5 1113192 111325 -outsize 512 512 test.xml test.png

Input file size is 40075016, 40075016
Computed -srcwin 21039368 20037513 111331 -111329 from projected window.
-srcwin 21039368 20037513 111331 -111329 falls outside raster size of 40075016x40075016
or is otherwise illegal.

------------------------------------------

but xml file seems to be valid:

rasterfoo->gdal-config --version
1.8.0

rasterfoo->gdalinfo test.xml

gdalinfo test.xml
Driver: WMS/OGC Web Map Service
Files: test2.xml
Size is 40075016, 40075016
Coordinate System is:
PROJCS["WGS 84 / Pseudo-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"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    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","3857"],
    AXIS["X",EAST],
    AXIS["Y",NORTH]]
Origin = (-20037508.339999999850988,20037508.339999999850988)
Pixel Size = (1.000000016968178,-1.000000016968178)
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.00"E,  0d 0'0.00"S)
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Undefined
  Overviews: 20037508x20037508, 10018754x10018754, 5009377x5009377, 2504689x2504689, 1252344x1252344, 626172x626172, 313086x313086, 156543x156543, 78272x78272, 39136x39136, 19568x19568, 9784x9784, 4892x4892, 2446x2446, 1223x1223, 611x611
Band 2 Block=1024x1024 Type=Byte, ColorInterp=Undefined
  Overviews: 20037508x20037508, 10018754x10018754, 5009377x5009377, 2504689x2504689, 1252344x1252344, 626172x626172, 313086x313086, 156543x156543, 78272x78272, 39136x39136, 19568x19568, 9784x9784, 4892x4892, 2446x2446, 1223x1223, 611x611
Band 3 Block=1024x1024 Type=Byte, ColorInterp=Undefined
  Overviews: 20037508x20037508, 10018754x10018754, 5009377x5009377, 2504689x2504689, 1252344x1252344, 626172x626172, 313086x313086, 156543x156543, 78272x78272, 39136x39136, 19568x19568, 9784x9784, 4892x4892, 2446x2446, 1223x1223, 611x611
Band 4 Block=1024x1024 Type=Byte, ColorInterp=Undefined
  Overviews: 20037508x20037508, 10018754x10018754, 5009377x5009377, 2504689x2504689, 1252344x1252344, 626172x626172, 313086x313086, 156543x156543, 78272x78272, 39136x39136, 19568x19568, 9784x9784, 4892x4892, 2446x2446, 1223x1223, 611x611



More information about the gdal-dev mailing list