[mapserver-users] QuerybyPoint blues

Hankley, Chip Chip.Hankley at gasai.com
Fri Oct 4 09:57:40 EDT 2002


Dylan,

> I'm confused how the template HTML file picks up the 
> necessary parameters, though.  I understand how it 
> works in the CGI version, but can't seem to get it 
> working in PHP Mapscript. Would you mind giving me 
> a peek at your ttt_query.html file?

There is no 'ttt_query.html' file. For some reason (that I don't
understand... the folks at DMSG would have to address that) that line MUST
be there for a query to work. The concept is really the same as w/ the rest
of PHP MapScript applications - you're not "filling in a template" as you do
with CGI MapServer... rather you are building content on the fly w/ PHP.
MapScript simply returns data on the server side, for you to process (in
this case, an array).

> I'd also be interested in seeing how you call your query function in 
> your PHP app.  Right now I'm calling it if the "Query" button is 
> checked.  Everything seems to be working (i.e., print and print_r 
> statements show the correct values), but I can't seem to display the 
> results.
> 
>    <input type="radio" name="mode" value="query"> Query
> 
>    // return query results, if Query radio button was checked
>    if($_POST['mode'] == 'query') {
>      query_map($map, $coords, $extent_to_set, 'water_bodies'); 
>    }

Well, what you have there *seems* to be going in the right direction, that's
basically what I do to (although I'm responding to an event from ROSA... but
that doesn't matter). Basically, you need to figure out why it's not working
;)

First, rule out the obvious (is the function firing, are the coordinates
being passed, what's coming out of the end, etc.).

My hunch is that what's happening is that your $extent_to_set variable is
screwing you up. That needs to be the extent that existed *when the user
clicked the map* - not any new extent that might be generated. Otherwise
your img_point to map_point conversion won't be working. Check this by
capturing the value of the converted coordinates and looking at them. You
should be able to do some backtracking and figure out whether or not it's
doing the conversion correctly.

HTH!

Chip Hankley



More information about the mapserver-users mailing list