[Mapserver-users] MapScript: map-Y coordinate is always wrong while map-X is right

Sean Gillies sgillies at frii.com
Wed Jul 9 10:38:12 EDT 2003


On Wednesday, July 9, 2003, at 01:05  AM, Bjoern Platzen wrote:

> Hi all,
>
> I found the final problem...
>
> It was not only the functions, that calculated, it was as well the
> parameters, I called the functions with:
>
> self.mapXY = self._click2map(float(self.webargs['img.x']),
> float(self.webargs['img.x']), self.mapExtent)
>                    ^^^^^^^
>
> But I still got one question:
> The map is initialized with an extend from the mapfile
> (2542000 5664000 2557000 5679000)
> The mapserv-cgi returns [mapext] = 2542091.670667 5664091.670667
> 2556908.329333 5678908.329333.
> I think the returned value is the imgext, right?
>
> So, can I get the imgext in MapScript or will I have to set the inital
> EXTENT in the mapfile to the visible extent? This would mean, that I
> would have to test each mapfile with the cgi to get the correct
> EXTENT-values, wich I can't believe...
>
> Thanks in advance,
>
> Bjoern.
>
>
Bjoern,

The reason why the mapext changes is that your requested mapext is
forced to make a best fit to your requested image size.

the draw() method of mapObj also does this as a side-effect, so you
may notice changes in the extents of your mapObj after you call draw().

PHP MapScript has a function that "normalizes" your extents to the
map size, but no such function is yet implemented in the Python or
Perl MapScripts.  If you really want it, enter it as a feature
request for MapServer 4.1 into the MapServer Bugzilla:

http://mapserver.gis.umn.edu/bugs/enter_bug.cgi

cheers,
Sean




More information about the mapserver-users mailing list