[mapserver-users] RE: querying to getting bounding box coordinates

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Wed Nov 24 00:02:30 EST 2010


There are 3 pieces to this:

1) in your mapfile you have to add validation for your query string to the layer metadata:

LAYER
  NAME 'testy'
  ...
  METADATA
    ...
    qstring_validation_pattern 'some regex'
  END
END

and you have to define a template, I prefer the new-style templates via an output format:

OUTPUTFORMAT
  NAME 'bbox'
  DRIVER TEMPLATE
  MIMETYPE 'MIMETYPE 'text/html'
  TEMPLATE 'bbox.html'
END

2) now create the template (bbox.html):

<!-- MapServer Template -->
[resultset layer="testy"]
[feature]
[shpext expand="20%"]
[/feature]
[/resultset]

(Note that in 5.6 you can set a few attributes in most extent-related tags to project and expand 
the output. This is very handy when getting extents to create other maps so you leave some space
around a feature.)

3) and finally a URL...

http://.../cgi-bin/mapserv?map=your.map&mode=itemquery&qitem=parcel_id&qstring=12345678&qlayer=testy&qformat=bbox

You could create templates more conducive to use with AJAX, perhaps JSON or XML. You have lots of control...

Steve


________________________________________
From: David Hildebrand [David.Hildebrand at afsc.ca]
Sent: Tuesday, November 23, 2010 5:58 PM
To: Lime, Steve D (DNR); mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] RE: querying to getting bounding box coordinates

I wanted to retain WMS compatibility but the WMS protocol does not seem
to support attribute queries.  I know I can use GetFeatureInfo to get
attributes including the bounding box of the feature because these are
CGI variables.  However, GetFeatureInfo uses a spatial query (an image
point).  If I use MapServer's mode=itemquery what would be the URL
syntax and the requirements on the server side?  Would I be able to
specify or determine the projection?

Thanks for your help.



===========================
David V. Hildebrand
Agriculture Financial Services Corporation
(403) 782-8239

www.afsc.ca <http://www.afsc.ca>
This communication is intended for the use of the recipient to which it
is addressed, and may contain confidential, personal and/or privileged
information. Please contact Agriculture Financial Services Corporation
immediately if you are not the intended recipient of this communication,
and do not copy, distribute, or take action relying on it. Any
communication received in error, or subsequent reply, should be deleted
or destroyed. Please consider the environment before printing this
email.


-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Lime,
Steve D (DNR)
Sent: Tuesday, November 23, 2010 3:52 PM
To: David Hildebrand; mapserver-users at lists.osgeo.org
Subject: [mapserver-users] RE: querying to getting bounding box
coordinates

Are you limited to WMS/WFS or can you use stock MapServer queries?
Passing in
a parcel id and returning it's bounding box is trivial using
mode=itemquery and
a template.

Steve

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of David
Hildebrand
Sent: Tuesday, November 23, 2010 2:49 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] querying to getting bounding box coordinates

I am running a WMS service with Mapserver in a Windows environment.  I
want to be able to run a non-spatial query on a parcel layer to return
the bounding box (in re-projected coordinates) for a particular parcel.
The bounding box and projection will then be used in a WMS query to
return a map image.

I've never coded server-side functionality with Mapserver so any
suggestions would be welcome.

Thanks to all.


===========================
David V. Hildebrand
Agriculture Financial Services Corporation
(403) 782-8239

www.afsc.ca <http://www.afsc.ca>
This communication is intended for the use of the recipient to which it
is addressed, and may contain confidential, personal and/or privileged
information. Please contact Agriculture Financial Services Corporation
immediately if you are not the intended recipient of this communication,
and do not copy, distribute, or take action relying on it. Any
communication received in error, or subsequent reply, should be deleted
or destroyed. Please consider the environment before printing this
email.


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


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






More information about the mapserver-users mailing list