Re: [mapserver-users] Understanding extents and resolutions
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.basq...@ci.stpaul.mn.us] Sent: Thursday, October 01, 2015 1:37 PM To: Lime, Steve D (MNIT) Cc: Zach Chehayeb; mapserver-users@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.l...@state.mn.us<mailto:steve.l...@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-boun...@lists.osgeo.org<mailto:mapserver-users-boun...@lists.osgeo.org> [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Zach Chehayeb Sent: Thursday, October 01, 2015 3:22 PM To: Basques, Bob (CI-StPaul) <bob.basq...@ci.stpaul.mn.us<mailto:bob.basq...@ci.stpaul.mn.us>> Cc: mapserver-users@lists.osgeo.org<mailto:mapserver-users@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.cheha...@airborne.aero<mailto:zach.cheha...@airborne.aero> Tel No. +1 949 707 1800 www.airborne.aero From: Basques, Bob (CI-StPaul) [mailto:bob.basq...@ci.stpaul.mn.us] Sent: Thursday, October 01, 2015 12:29 PM To: Zach Chehayeb Cc: mapserver-users@lists.osgeo.org<mailto:mapserver-users@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.cheha...@airborne.aero<mailto:zach.cheha...@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 Sout
[mapserver-users] Understanding extents and resolutions
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.cheha...@airborne.aero<mailto:zach.cheha...@airborne.aero> Tel No. +1 949 707 1800 www.airborne.aero [New Small2] ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
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.cheha...@airborne.aero<mailto:zach.cheha...@airborne.aero> Tel No. +1 949 707 1800 www.airborne.aero [New Small2] From: Basques, Bob (CI-StPaul) [mailto:bob.basq...@ci.stpaul.mn.us] Sent: Thursday, October 01, 2015 12:29 PM To: Zach Chehayeb Cc: mapserver-users@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.cheha...@airborne.aero<mailto:zach.cheha...@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.cheha...@airborne.aero<mailto:zach.cheha...@airborne.aero> Tel No. +1 949 707 1800 www.airborne.aero ___ mapserver-users mailing list mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org> http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Square Edges Using labelpoly
Håvard, Thanks for your help. Unfortunately, the polygon did not change when specifying LINEJOIN miter (see below) and still has curved edges. Any other ideas? STYLE ANGLE 0 COLOR 149 149 149 GEOMTRANSFORM labelpoly OFFSET 0 0 OUTLINECOLOR 149 149 149 WIDTH 22 LINEJOIN miter END # STYLE Regards, Zach -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Håvard Tveite Sent: Wednesday, October 22, 2014 12:17 AM To: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Square Edges Using labelpoly LINEJOIN miter in the STYLE element should work also for labelpoly see http://mapserver.org/mapfile/style.html LABEL STYLE GEOMTRANSFORM labelpoly OUTLINECOLOR 255 0 0 WIDTH 4 LINEJOIN miter END # Style ... END # Label Håvard On 2014-10-21 23:37, Zach Chehayeb wrote: Hi All, Does anyone know if it possible to create a labelpoly (as in GEOTRANSFORM labelpoly) with straight edges instead of curved edges? Regards, Zach ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Håvard Tveite Department of Mathematical Sciences and Technology, NMBU Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.nmbu.no/imt/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Square Edges Using labelpoly
The two styles suggestion worked. Thank you both for your help! Steve, Do you know if this is still an issue with the current release of mapserver? I am running 6.0.3 so I am curious to know if this issue still exists. If so, would you like me to raise a ticket for this? Regards, Zach -Original Message- From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: Wednesday, October 22, 2014 2:23 PM To: Zach Chehayeb; Håvard Tveite; mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] Square Edges Using labelpoly Seems to be the combination of the fill and the outline that forces the rounded outline. Here's a test: 1) Outline, LINEJOIN MITER, LINECAP SQUARE: http://maps1.dnr.state.mn.us/cgi-bin/mapserv64?map=/usr/local/mapserver/apps/test/labelpoly/test1.mapmode=map 2) Fill and outline, LINEJOIN MITER, LINECAP SQUARE: http://maps1.dnr.state.mn.us/cgi-bin/mapserv64?map=/usr/local/mapserver/apps/test/labelpoly/test2.mapmode=map Besides seemingly not respecting the LINEJOIN/LINECAP values, the label polygon doesn't include the baseline decent of the lower case y. Hmmm... Sure seems like a bug... However, you can work around it. Just use two styles. One to draw the outline and one to fill... (see mapfile below) 3) Two styles, outline uses LINEJOIN MITER, LINECAP SQUARE: http://maps1.dnr.state.mn.us/cgi-bin/mapserv64?map=/usr/local/mapserver/apps/test/labelpoly/test3.mapmode=map Steve snip MAP NAME 'test' EXTENT 0 0 500 500 SIZE 500 500 FONTSET 'fonts.list' SYMBOL NAME 'circle' TYPE ELLIPSE POINTS 1 1 END FILLED TRUE END LAYER NAME 'label' TYPE POINT STATUS DEFAULT FEATURE POINTS 50 250 END TEXT 'my label text' END LABELITEM 'text' CLASS LABEL POSITION UR TYPE TRUETYPE FONT 'arial' SIZE 40 COLOR 0 0 0 STYLE GEOMTRANSFORM labelpoly # COLOR 255 0 0 OUTLINECOLOR 255 0 0 WIDTH 10 LINEJOIN miter LINECAP square END # Style STYLE GEOMTRANSFORM labelpoly COLOR 255 0 0 END # Style END # Label END END END -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Zach Chehayeb Sent: Wednesday, October 22, 2014 1:38 PM To: Håvard Tveite; mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Square Edges Using labelpoly Håvard, Thanks for your help. Unfortunately, the polygon did not change when specifying LINEJOIN miter (see below) and still has curved edges. Any other ideas? STYLE ANGLE 0 COLOR 149 149 149 GEOMTRANSFORM labelpoly OFFSET 0 0 OUTLINECOLOR 149 149 149 WIDTH 22 LINEJOIN miter END # STYLE Regards, Zach -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Håvard Tveite Sent: Wednesday, October 22, 2014 12:17 AM To: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Square Edges Using labelpoly LINEJOIN miter in the STYLE element should work also for labelpoly see http://mapserver.org/mapfile/style.html LABEL STYLE GEOMTRANSFORM labelpoly OUTLINECOLOR 255 0 0 WIDTH 4 LINEJOIN miter END # Style ... END # Label Håvard On 2014-10-21 23:37, Zach Chehayeb wrote: Hi All, Does anyone know if it possible to create a labelpoly (as in GEOTRANSFORM labelpoly) with straight edges instead of curved edges? Regards, Zach ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Håvard Tveite Department of Mathematical Sciences and Technology, NMBU Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.nmbu.no/imt/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Square Edges Using labelpoly
Hi All, Does anyone know if it possible to create a labelpoly (as in GEOTRANSFORM labelpoly) with straight edges instead of curved edges? Regards, Zach ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users