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

Stephen Woodbridge woodbri at swoodbridge.com
Wed May 19 11:55:55 EDT 2004


Ah, that is much clearer. Ok, you have assessed your current situation 
correctly. If you are using the templates, you are limited to what you 
can do on the client.

If you want to do more server side processing of the query then you have 
to have a server side process that runs it. So then the question becomes 
how to envoke the process.

Some ideas,

1) generate a template that does a java script open of a new page and 
the url for the new page passes the initial information about the query 
to a Perl or PHP script that then does the rest of the work and return 
the final page you want. You can pass the initial parameters as URL 

2) change you action on the map to call a Perl or PHP script and pass 
the map.x, map.y and other parameters to it then have it do the query in 
mapscript and do whatever else you want and return a page. To change the 
action and target to a new window you will have to do a little javascript.

I like 2) because I think it is cleaner.

There is no easy way to "hook" into the mapserver process that is 
processing your HEADER/FOOTER/TEMPLATE stuff short of hack into the 
mapserver code which is not required if you use mapscript.

Hope this is more helpfull,

Ethan Alpert wrote:

> Ok I see how this is done it a perl script but this doesn't match how
> I'm currently using mapserv. Perhaps I wasn't clear in my original
> question.
> I have a LAYER defined using TEMPLATE, HEADER, FOOTER. Theses are used
> to display spatial query results which are driven by dbox selections.
> The problem for me is I'd like to do more inteligent things with the
> results of the query but appear to be limited to HTML and client side
> JAVASCRIPT because the content type of the output from
> TEMPLATE,HEADER,FOOTER is html. I'd like to use php or perl in the page
> to grab more information from my DB's to display based on the query
> results.
> Does this make sense? Is there an alternative to using TEMPLATE,HEADER,
> FOOTER in my mapfiles? Is it possible for TEMPLATE,HEADER,FOOTER to be
> php files? I may be mistaken but I've been unable to find answers.
> Also how does one search the archives by keyword? The mailman interface
> displays only by date which doesn't make searching very practical.
> -e
> -----Original Message-----
> From: Stephen Woodbridge [mailto:woodbri at swoodbridge.com] 
> Sent: Tuesday, May 18, 2004 6:32 PM
> To: Ethan Alpert; MapServer List
> 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 
>>I need to access information about items that were selected with a 
>>-----Original Message-----
>>From: Stephen Woodbridge [mailto: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
>>Yes, and there are examples. See
>>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?
>>>Mapserver-users mailing list Mapserver-users at lists.gis.umn.edu 

More information about the mapserver-users mailing list