[mapserver-users] Query and template files

Azimuth, Erwin Perik perik at azimuth.nl
Wed Feb 20 00:18:59 PST 2002


Hi Michel,

In the GMAP version the query (by button) is retreiving information 
according to METADATA set in your layers.

Basicly it goes like this:


1) GMap75CheckClick() --> checks user input on the rosa-map, eg zoom-in 
zoom-out, pan, query.
2) When query button is used and then user clicks on map it uses following:

else if ($HTTP_FORM_VARS["CMD"] == "QUERY_POINT")

a) here it checks if point or rectangle is used
b) pixel-coords are then translated to geo-coords
c) query:
         * @$gpoMap->queryByPoint($oClickGeo, MS_SINGLE, -1);    <-- 
queries the map (single point)
         * @$gpoMap->queryByRect($oGeorefRect);  <-- queries the map 
(rectangle)
d) $gbShowQueryResults = TRUE;  <-- query is used
e) it now reloads gmap.php
f) in gmap.php you see:   <?php GMapDumpQueryResults(); ?>
g) this uses the function GMapDumpQueryResults()
h) In your map-file, it checks for the following in every layer:
       METADATA
         "DESCRIPTION"   "PrintedDescription"
         "RESULT_FIELDS" "FIELD ANOTHER_FILED"    # Field names of you 
.dbf-file
       END
i) if it finds metadata it passes it to the main file (gmap.php)
j) also any found objects are now highlighted in the main map
* Every time gmap.php is loaded it uses the function GMapDrawMap() :

     if ($gbShowQueryResults)    // <-- found objects, so drawQuery, 
highlights the objects
         $img = $gpoMap->drawQuery();
     else                        // <-- nothing found, draw normal map 
(nothing changes)
         $img = $gpoMap->draw();
k) General info: certain Variables (like $gpoMap) are set to global to use 
for other functions


You now can add features like:
NewExtent --> map zooms in to the rectangle you used for query based on the 
geo-coords of the rectangle

I never got into the CGI stuff cause i loced the combination of Mapscript 
and Rosa, so sticking with that.

Good luck,

Erwin






At 15:08 19-2-02 -0300, Michel M. dos Santos wrote:


>         Hello ,
>
>         In the example of Itasca , with cgi mode the queries are done by 
> templates
>files. With the example of gmap , with mapscript/php are done other way. I'm
>confused with this.
>
>         Somebody can help me ?
>
>[]'s
>Michel M. dos Santos


=================
Azimuth Geodetic
Koldingweg 8
9723 HK Groningen
tel. 050-5493454
fax. 050-5497217
=================
www.azimuth.nl
perik at azimuth.nl
=================




More information about the MapServer-users mailing list