[mapserver-users] Using Open street map tiles via GDAL_WMS

Brent Fraser bfraser at geoanalytic.com
Fri Jul 9 15:40:29 EDT 2010


It took a little debugging (the ultimate documentation), but the answer is to add:

	PROCESSING "OVERSAMPLE_RATIO=1"  # the default is 2!
	PROCESSING "LOAD_FULL_RES_IMAGE=NO"

to the layer in map file.

Best Regards,
Brent Fraser


Brent Fraser wrote:
> James,
> 
>   Did you find a solution to this problem?  I'd like to use OSM tiles in 
> Mapscript to create an image for server-side creation of large format 
> PDFs for printing, and found that mapserver+GDAL does not calculate the 
> best TileLevel based on the output extents and image size.
> 
>   For example, in my XML file I have:
>         <TileLevel>15</TileLevel>
> 
> When using gdal_translate:
> 
>   gdal_translate -projwin  -12412016 7714617 -12384098 7693893 -outsize 
> 1461 1084  frmt_wms_osm_tms.xml test.tif
> 
> GDAL requests Level 13 images, and produces a great looking image.  
> However Mapserver's shp2img:
> 
>   shp2img -e -12412016 7693893 -12384098 7714617 -s 1461 1084 OSM.map -o 
> test.png
> 
> requests Level 14 (too high a resolution); many more tiles are requested 
> and down-sampled, and the image is un-readable.
> 
> Best Regards,
> Brent Fraser
> 
> 
> James Perrins wrote:
>> I've been trying to use Open street map tiles via a mapserver WMS
>> service displayed in OpenLayers.
>>
>> This is sort of working - in that I'm getting maps displayed and they
>> seem to be in the right position (as checked against other datasets).
>>
>> My issue is that the images are nowhere near as clear as the originals
>> from the Open Street map tiles.  I've kept projections the same
>> throughout - and they don't appear to be being re-projected.  The
>> images saved in the local cache (if enabled) are the same as from Open
>> Street Map.  What appears to be happening is that mapserver is getting
>> images from (perhaps) a zoom level too high - and then re-sampling
>> these to produce the WMS output image - which then appears to have too
>> much detail displayed for its zoom level (if you understand what I'm
>> trying to say).
>>
>> Any ideas why this is happening - I've messed around with Bounding
>> boxes and image sizes - but it doesn't seem to make any difference.
>>
>> Thanks
>> James
>>
>>
>> MapFile extract:
>>
>> LAYER
>>     NAME "OSM"
>>     STATUS ON
>>     TYPE RASTER
>>     DATA "D:\Websites\OpenStreetMap\OSM.xml"
>>     PROJECTION
>>       "init=EPSG:900913"
>>     END
>> END   
>>
>>
>> <GDAL_WMS>
>>     <Service name="TMS">
>>         
>> <ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
>>     </Service>
>>     <DataWindow>
>>         <UpperLeftX>-20037508.34</UpperLeftX>
>>         <UpperLeftY>20037508.34</UpperLeftY>
>>         <LowerRightX>20037508.34</LowerRightX>
>>         <LowerRightY>-20037508.34</LowerRightY>
>>         <TileLevel>19</TileLevel>
>>     <TileCountX>1</TileCountX>
>>     <TileCountY>1</TileCountY>
>>         <YOrigin>top</YOrigin>
>>     </DataWindow>
>>     <Projection>EPSG:900913</Projection>
>>     <BlockSizeX>256</BlockSizeX>
>>     <BlockSizeY>256</BlockSizeY>
>>     <BandsCount>3</BandsCount>
>> </GDAL_WMS>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 



More information about the mapserver-users mailing list