[Mapserver-users] How can I get the query info programatically?

Stephen Woodbridge woodbri at swoodbridge.com
Wed May 19 06:09:01 PDT 2004


Mapserver already supports two types of query operations:

1) itemquery that allow you to search DBF records for attribute match(s) 
and returns the spatial objects,

2) spatial queries based on point and tolerance (radius) or a bounding 
box and will return the closest object or multiple objects depending on 
the query options.

If you want to invent your own that is fine, but mapserver already 
supports a lot of this functionality. You need to build a simple test 
case and get it working. Make a one polygon layer and write a mapfile 
and a mapscript application that takes a lat/lon and does a point query 
and lists out the polygon info that it hit.

This is relatively simple and straight forward but the documentation on 
how to do this is a little lacking in the "HowTo" department. I'm sure 
people will help with specific problems you run into. You should be able 
to get the basic idea if you read through the wiki examples and read the 
mapscript docs.

Make sure your LAYER ... END in your mapfile has a TEMPLATE "dummy" tag 
or you will never get any results.

-Steve

phatsbbnlist at twcny.rr.com wrote:

> I haven't gotten this far yet, but I have thought about it. If you have the proper db drivers for your scripting tools, couldn't you save the parameters you insert into variables from the form and map choices (that drive the queries) into prepared sql statements to derive the info? e.g. your user clicks on a location, which the web server knows in image coordinates and converts to map coordinates after you pass them along. The map and scale should be known, the points can be calculated and a query of the dbf files should retrieve the data from individual layers that match. This sounds simplistic, but I don't see apriori why it should fail miserably.
> ----- Original Message -----
> From: Stephen Woodbridge <woodbri at swoodbridge.com>
> Date: Tuesday, May 18, 2004 8:31 pm
> Subject: Re: [Mapserver-users] How can I get the query info programatically?
> 
> 
>>Ethan,
>>
>>THere are ac bunch of Query examples at
>>http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples35
>>for mapserver 3.5 but on the bottom is an example mapserver 4.2. 
>>Look at 
>>the quake.pl I think that does some query stuff.
>>
>>I also check the archives, because this has been asked before. I 
>>thought 
>>there was a straight forward query example, but I can't seem to 
>>locate 
>>the one I was thinking of. Once you get your example worked out 
>>you 
>>might want to post it to the wiki for others.
>>
>>-Steve
>>
>>Ethan Alpert wrote:
>>
>>
>>>Any chance you can be more specific? I've been to the docs 
>>
>>several times
>>
>>>looking for how to do this and I'm not finding what I'm looking for.
>>>
>>>I need to access information about items that were selected with a
>>>query.
>>>
>>>-e
>>>
>>>-----Original Message-----
>>>From: Stephen Woodbridge [woodbri at swoodbridge.com] 
>>>Sent: Tuesday, May 18, 2004 5:39 PM
>>>To: Ethan Alpert
>>>Cc: mapserver-users at lists.gis.umn.edu
>>>Subject: Re: [Mapserver-users] How can I get the query info
>>>programatically?
>>>
>>>
>>>Yes, and there are examples. See
>>>
>>>http://mapserver.gis.umn.edu/doc.html
>>>http://mapserver.gis.umn.edu/cgi-bin/wiki.pl
>>>
>>>-Steve
>>>
>>>Ethan Alpert wrote:
>>>
>>>
>>>
>>>>I'd like to get the information of the items selected in a 
>>
>>query. The 
>>
>>>>template approach isn't quite what I'm looking for. Is there a 
>>
>>way to 
>>
>>>>extract this info with perl (or php) mapscript?
>>>>
>>>>-e
>>>>
>>>>_______________________________________________
>>>>Mapserver-users mailing list Mapserver-users at lists.gis.umn.edu
>>>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>>>
>>>
>>>
>>>
>>_______________________________________________
>>Mapserver-users mailing list
>>Mapserver-users at lists.gis.umn.edu
>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>
> 
> 
> 




More information about the MapServer-users mailing list