[mapserver-users] TMS layer via GDAL minidriver, drawing shapeObj.fromWKT() and limiting extent to random size gives distorted image

SQ9MEV groups at sq9mev.info
Wed Nov 14 02:33:20 PST 2012


Hi everybody.

I'm using python mapscript bindings to draw my feature (wkt) on "base 
layer" - this one is TMS available via GDAL minidriver.
What i want to get is custom size image of my feature drawn on the 
background of "base layer".

Mapscript i use is like this:

1. shape=shapeObj.fromWKT(elements.wkt)
2. layer = mapobj.getLayerByName(layername)
3. layer.addFeature(shape)
4. extent=shape.bounds
5. mapobj.setExtent(extent.minx, extent.miny, extent.maxx, extent.maxy)
6. mapobj.draw()

Mapfile and minidriver code is here:
http://www.olpiny.pl/ump.map
http://www.olpiny.pl/frmt_wms_ump_tms.xml

This works almost well, map is drawn, but "base layer" is resampled, and 
due to this image is a little distorted:
http://www.olpiny.pl/000000001354.png

I was playing with several resampling processing options (you can see it 
in mapfile), but after rethinking my problem i think i know the reason: 
I set more or less random extent (line 5), and it will not be multiple 
size of basemap tiles, and it has to be scaled somehow to my custom 
image size, so base layer will be resampled almost always.

I think i should calculate extent basing on extent fo my feature, and 
size of my image somehow, to ensure that base layer will not be rescaled.

Any ideas how to solve this problem?

Thanx in advance guys.

-- 
Bartek Radwan



More information about the MapServer-users mailing list