[mapserver-users] Querying layers for feature attributes

Ted Spradley tspradley at snoogems.com
Sat Oct 10 15:06:28 EDT 2009



Steve Lime wrote:
> 
> Here goes nothing (using the CGI)...
> 
> 1. to make a layer queryable simply add a TEMPLATE directive to the layer
> definition. It need not
> reference a real template file and just needs some value. I often use:
> 
>   TEMPLATE 'dummy' # make this layer queryable
> 
> 2. here you need to define the QUERYMAP object and set its STATUS to ON.
> The object itself is
> very simple. You can choose from 3 types and can change the hilite color.
> There are three ways
> to trigger the creation of the image
> 
>   a. if the status is on then the image will automatically be created for
> you (in the temp directory)
> and can be referenced in query template processing using the [img] tag.
> 
>   b. all of the query-related CGI modes have a form that will retrieve
> just the query map. For example
> you can do mode=NQUERYMAP or mode=ITEMNQUERYMAP. The list is long and
> unwieldy.
> 
> 

Steve,  

I am able to successfully produce and view an image that is composed of http
linked area elements based on a layer of usa states from a Tiger Line
shapefile with the url call
'http://url.com/cgi-bin/mapserv?map=/path/to/mapFiles/mini_wms.map&qlayer=states_poly&mode=nquery&searchmap=true'

My lack of understanding of the url component of the query template produces
an area element for the state of Nebraska like:

<area shape="poly" coords="369,338 369,339 ..."
href="http://url.com/cgi-bin/mapserv?map=/path/to/mapFiles/mini_wms.map&layer=states_poly&mode=map&id=31"
title="Nebraska" alt="Nebraska">

>From my query template:

<area shape="poly" coords="[shpxy precision=0 proj=image]"
href="http://url.com/cgi-bin/mapserv?map=/path/to/mapfile/mini_wms.map&layer=states_poly&mode=map&id=[STATEFP]"
title="[NAME]" alt="[NAME]">

I get that, in the browser, with a user click on one of the area elements of
the map, the url component calls back to mapserv to redraw the map. 
Somewhere though, the mapfile or query template must tell mapserv to draw
the area element identified by 'id=31' differently than all of the other
id's in the map image.  So, I don't think it is so much a misunderstanding
of the url component per se, but a lack of knowing where to put the
instruction (I am guessing in the mapfile LAYER object) for mapserv to use
the information sent in the url.

Am I looking in the right area?

Thanks again,
Ted S.
-- 
View this message in context: http://n2.nabble.com/Querying-layers-for-feature-attributes-tp3791433p3800839.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list