[mapserver-users] PHP Mapscript delivers map with larger extent than requested

Stephen Woodbridge woodbri at swoodbridge.com
Sun Oct 25 01:06:00 EDT 2009


Chuck Jungmann wrote:
> I am a new user of MapServer, using version 5.0.3 from the Ubuntu
> repositories.  I attempted to compile everything from source, had some
> trouble, then decided to use the repository shortcut at least until I
> understood how the application works.
> 
> I am writing an application where the browser requests a map by setting
> the src attribute of an img object.  Identifying locations on the
> resulting map requires that the application knows the extent.
> 
> I calculate the extent of the map from various values, and use the same
> algorithms on the server so the browser and the server agree on the
> dimensions without having to negotiate.  However, when I request the map
> from MapServer, the extent of the resulting map is always larger (both x
> and y dimensions) than what I requested, although still centered on the
> same point.
> 
> Is this behavior normal (I don't want to beat my head against the wall
> searching for an irrelevant math error)?  Is there some setting that
> might cause MapServer to more closely match my requested extent?  Could
> this be an error that was fixed in a more recent version of MapServer?
> 
> Any words of wisdom would be appreciated.

Chuck,

There are a number of conditions that may make mapserver checnge the 
extents requested.

1) mapserver assumes square pixels, so if you ask for an extents that 
has a different aspect ratio than that of you image size then mapserver 
will make adjusts.

2) if you ask for extents and a scale, I think, mapserver will use the 
extents to determine the center and then adjust the extents to the scale

Are you using the CGI interface? what does you request look like? You 
need to give us more concrete examples that we can try here to test out 
and explain what is happening. What version of mapserver are you using?

/path/to/mapserv -v

Will report how it was build with options and version number.

-Steve W.


More information about the mapserver-users mailing list