[mapserver-users] Query and template files

Lowell Filak lfilak at medinaco.org
Fri Feb 22 11:33:42 EST 2002


I can't give a PHP example but:
Once you have the shape:
make sure there is a place-holder layer in your mapfile set to off.
create a new shapfile object.
add the shape(s) to the shapefile object.
(don't forget to do a system level equivalent of "touch <shapefile>.dbf").
get a new layer object (the place-holder layer).
turn the layer on.
set the layer "data" to the name of the new shapefile.
draw the map.
Lowell F. 

The following message was sent by "Azimuth, Erwin Perik" <perik at azimuth.nl> on Fri, 22 Feb 2002 14:06:59 +0100.

> Hi Michel,
> 
> Mmm,... coinsidence,.... working on about the same idea as you described ;-)
> 
> Relationship is ok. Once you have the correct row you can then use that one 
> to search for the shape.
> 
> Myself i use PHP mapscript,... where i do it like this:
> 
> Search-Field ---> calls a javascript --> pass variables (like the 
> search-field) to a popup window.
> This popup is a php file which uses the variables bassed by the javascript.
> 
> In that popup-php it searches the dbf using standard PHP functions. It then 
> returns both fields and values of the found row(s).
> These fields are then passed to the popup-page.
> 
> It then is possible (you have it's index) to get the shape, create new 
> extents, create the image and show it.
> Highlighting is still my problem,.... i can only get the complete layer to 
> highlight, but as it's zoomed in (shape-extents) it is no real bother.
> 
> I do however want to show only the found shape in an overview-map, but not 
> found out how yet. Tried numerous, but all failed.
> Any help regarding this would be great ;-)
> 
> Erwin
> 
> 
> At 17:14 21-2-02 -0300, Michel M. dos Santos wrote:
> 
> 
> >         Thanks Erwin,
> >
> >         I have another question:
> >
> >         I want to do a search, for example, by name of the streets. In my 
> > html page
> >I put a form for the user write the street he wants to search. The street is
> >localized and displayed in the map. I need to search the record in dbf file
> >and after in shape file ? I now the relation between dbf file and shape file
> >are done by record number, correct ?
> >
> >[]'s
> >Michel M. dos Santos
> >
> >
> >
> >Em Qua 20 Fev 2002 05:18, Azimuth, Erwin Perik escreveu:
> > > 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
> > > =================
> 
> 
> =================
> 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