[mapserver-users] Understanding extents and resolutions

Zach Chehayeb zach.chehayeb at airborne.aero
Thu Oct 1 15:01:09 PDT 2015


Thank you both for you responses!

What you have described below does align with my observations.

I will reply if I should notice any inconsistencies after examining the code you pointed out Steve.

Thanks again,

Zach

From: Basques, Bob (CI-StPaul) [mailto:bob.basques at ci.stpaul.mn.us]
Sent: Thursday, October 01, 2015 1:37 PM
To: Lime, Steve D (MNIT)
Cc: Zach Chehayeb; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Understanding extents and resolutions

All,

Yeah, I just figured it out for myself too.  My tests were against a WMS call to MapServer vs a MapServer direct call.  The MapServer call will do the padding, but a WMS will stretch ( as it’s supposed to)

bobb




On Oct 1, 2015, at 3:34 PM, Lime, Steve D (MNIT) <Steve.Lime at state.mn.us<mailto:Steve.Lime at state.mn.us>> wrote:

MapServer compares the requested extent to the aspect ratio of requested image. The code (msAdjustExtent in maputil.c) starts by computing a cellsize in each direction (x and y)  and then uses the largest value to pad the other. You’re guaranteed to preserve the extent in one of the direction and maybe both.

Steve

From: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Zach Chehayeb
Sent: Thursday, October 01, 2015 3:22 PM
To: Basques, Bob (CI-StPaul) <bob.basques at ci.stpaul.mn.us<mailto:bob.basques at ci.stpaul.mn.us>>
Cc: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Subject: Re: [mapserver-users] Understanding extents and resolutions

Bob,

I am not sure I am understanding your response correctly. Are you suggesting that it is the coordinate window ratio that determines whether mapserver locks on the east/west or north/south bounds? If so, this doesn’t align with my observations below as all the images where sent the exact same coordinate window but pad on a different axis.

I plan to do the computation to match up exactly as you have suggested but I want to be sure that I correctly understand the logic that mapserver uses to decide which axis to pad so I can apply the computations to the correct axis. I have to maintain backward compatibility in my application and need to accurately assess the actual extent drawn.

Regards,

Zach Chehayeb
Application Developer
Email. zach.chehayeb at airborne.aero<mailto:zach.chehayeb at airborne.aero>
Tel No.  +1 949 707 1800
www.airborne.aero<x-msg://48/www.airborne.aero>

<image001.gif>



From: Basques, Bob (CI-StPaul) [mailto:bob.basques at ci.stpaul.mn.us]
Sent: Thursday, October 01, 2015 12:29 PM
To: Zach Chehayeb
Cc: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Subject: Re: [mapserver-users] Understanding extents and resolutions

Zach,

If I’m understanding your question correctly, MapServer will always give you your requested coordinate space inside of the requested image size, by buffering the image results along the axis that is larger than the coordinate window needs to draw completely.  In other words, MapServer automatically pads the output image to fill in those areas, East/West and North/South edges based on the coordinate space requested.

If you need them to match up exactly, then you need to do the computations in your application to make the correct requests and make the coordinate window ratio match the pixel window (image size) ratios.

bobb



On Oct 1, 2015, at 2:13 PM, Zach Chehayeb <zach.chehayeb at airborne.aero<mailto:zach.chehayeb at airborne.aero>> wrote:

Hello All,

Can anyone explain or point me in the right direction on how mapserver logic works when a requested map extent cannot be produced at the requested resolution with square pixels?

I am using mapserver in an application that requests mapserver to produce various map extents at various resolutions. The map config is set to not allow non square pixel (so the MS_NONSQUARE setting is set to no).  The application currently assumes that the extent height should always be half of the width. Of course, with MS_NONSQUARE set to no and producing resolutions where the height is not always exactly half of the width, mapserver is unable to produce the exact extents requested. As such, mapserver compensates by extending either the north and south or east and west bounds of the map. See images in link below for a detailed illustration (the red box indicates the requested extent). For all images below, the requested extent is  x1=-58.615527, y1=50.434875, x2=-13.615527, y2=72.934875, but the actual extents differ.

From my observations, it seems that there are three cases. I have included a link below where a zip file that has examples of the cases can be downloaded.
https://www.dropbox.com/s/dy1cgmt8lmbl3wf/Example%20Images.zip?dl=0
1.      The requested resolution height is greater than half of the width (1280x720).
a.      Result: MapServer locks on the East and West bounds and extends the North and South bounds of the map.
2.      The requested resolution height is less than half of the width (960x400).
a.      Result: MapServer locks on the North and South bounds and extends the East and West bounds.
3.      The requested resolution height is half of the width (1000x500).
a.      Result: MapServer produces the image at the requested resolution.

Is anyone able to confirm that these are the only three cases or correct my understanding (if there is more to it than I have described)?

Some info about my installation:
1.      MapServer version 6.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=THREADS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Please let me know if there is any other information needed.

Thanks in advance,

Zach Chehayeb
Application Developer
Email. zach.chehayeb at airborne.aero<mailto:zach.chehayeb at airborne.aero>
Tel No.  +1 949 707 1800
www.airborne.aero<x-msg://46/www.airborne.aero>

<image001.jpg>




_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/mapserver-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151001/62d36e1d/attachment-0001.html>


More information about the mapserver-users mailing list