[mapguide-users] Simple Query. How to.

Willem Schwarte willem at giskit.nl
Mon Feb 12 09:45:47 EST 2007


You can create a layer in studio as how it should look, and save this as
a XML file (menu File).

Then you can load this XML as a new layer in your code and set the
FILTER (id=1 or whatever) add the layer to your map and refresh (or
not). 

This is how I do this. There is an example on the example site on
osgeo.org.

Something like this: 

   // Change the filter
    $xpath = new DOMXPath($domDocument);

    $query = '//Filter';
    // Get a list of all the <AreaRule><Filter> elements in
    // the XML.   
    $nodes = $xpath->query($query);

    // Find the correct node and change it , this is the filter
    foreach ($nodes as $node )
    {
            $node->nodeValue = '"afz_nr" = '.$_GET['afznr'].'';
    }
	
    
    // Add the layer to the map
    $layerDefinition = $domDocument->saveXML();

	   $newLayer = add_layer_definition_to_map($layerDefinition,
"newlayer", "Route", $sessionId, $resourceService, $map,0);


Willem



-----Oorspronkelijk bericht-----
Van: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] Namens MaciekS
Verzonden: maandag 12 februari 2007 15:33
Aan: mapguide-users at lists.osgeo.org
Onderwerp: [mapguide-users] Simple Query. How to.


Hi MapGuide developers.

Does somebody know how to filter data on specified, existing layer?

I added a layer from a SHP file to my repository using MapGuide Studio.
Now I'd like to filter this layer from my code with a simple query, for
example (where ID=1).
How should I built my code to execute the query that finally will
display in
the browser only polygons specified in the query?

Regards, Maciek

-- 
View this message in context:
http://www.nabble.com/Simple-Query.-How-to.-tf3214017s16610.html#a892519
4
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list