[mapserver-users] WMS non-square extent query using openlayers

David Quinn daithiquinn at gmail.com
Wed Jan 25 18:34:13 EST 2012


Frank,

Thanks for your comments.

On Wed, Jan 25, 2012 at 6:04 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> David,
>
> MapServer is definately able to return results that are non-square,
> and further that do not have 1:1 aspect ratio with the geo request
> (thus resulting in requesting so called "non square pixels").  In WMS
> mode I believe non-square pixel support is enabled by default - I think
> this is not the case in traditional MapServer mode.
>

Just to clarify - so non-square results should be returned without doing
anything special on the mapserver side?

>
> But if I were you, I'd start by examining that WMS request is actually
> being generated and sent to MapServer by OpenLayers and determine
> if it is doing what it ought to.
>

This is an example of the html that is returned on screen:

<img id="OpenLayersDiv119" style="width: 256px; height: 256px; position:
relative; opacity: 0.5;" class="olTileImage" src="
http://mysite.com/mapserv.cgi?map=roads.map&amp;LAYERS=roads&amp;TRANSPARENT=TRUE&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;STYLES=&amp;FORMAT=image%2Fpng&amp;SRS=EPSG%3A900913&amp;BBOX=-8234561,4996137,-8214993,5015705&amp;WIDTH=256&amp;HEIGHT=256
">

In this case, I set SIZE 64 64 in my mapfile, but it did not make a
difference, as 256 seems to be used. The polygon bounds calculated in
browser using openlayers are as follows: -8254128,4976569,-8215574,4996932

I can now see that the problem is due to the entire tile being included,
and not clipped to the upper extent. But this is strange, as the verticals
are being clipped ok, as is the lower extent.


> BTW, I'm surprised you are seeing "three sides" of the request and
> one not being.  When MapServer fixes extents that imply non-square
> pixels it would end up changing two sides (actual sides or bottom and
> top) equally.
>
> Best regards,
>

> On Wed, Jan 25, 2012 at 2:43 PM, David Quinn <daithiquinn at gmail.com>
> wrote:
> > Hi List,
> >
> > Is it possible to receive a non-square tile, or collection of tiles,
> from a
> > WMS query? I'm using openlayers to send a WMS query based on a
> user-chosen
> > extent of a rectangular polygon. My javascript is as follows:
> >
> >     WMSLayer = new OpenLayers.Layer.WMS(
> >            "layerName",
> >            "wms_server",
> >            {layers: 'roads', },
> >            {'maxExtent': polygonBounds}
> >        );
> >
> > The initial part of my .map file is:
> >
> > MAP
> >     NAME
> >  "roads"
> >     UNITS          meters
> >     EXTENT       -850000 495000 -890000 500000
> >     SIZE             256 256
> >     STATUS       OFF
> >     DEBUG        ON
> >
> > and I am returning information from a raster.The query returns a WMS
> layer
> > fine, but only three of the four sides of the polygon have the correct
> > extents, and the WMS layer is a square. I've tried to illustrated this in
> > the below diagram:
> >
> > X = requested
> > _____________
> > |                        |
> > |       XXXX       |
> > |       XXXX       |
> > |                        |
> > ---------------------
> >
> > Y = returned
> > _____________
> > |       YYYY        |
> > |       YYYY        |
> > |       YYYY        |
> > |                         |
> > ----------------------
> >
> > I've tried adjusting the SIZE values but this does not seem to change the
> > limit. The extents are definitely correct, as I've used them for querying
> > non-WMS data that is displayed in-browser. When I subtracted a value from
> > the "bound.top" value in Openlayers, the correct values were returned,
> but
> > this did not seem like the right way to fix the problem. I'd appreciate
> any
> > suggestions!
> >
> > Thanks,
> > David
> >
> >
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
>
>
>
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Software Developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120125/2da83af0/attachment-0001.html


More information about the mapserver-users mailing list