[mapguide-users] Simple Query. How to.

irwan anakando at yahoo.com
Mon Jan 12 21:19:24 EST 2009


this is what i'm looking for..but what if i used data from sql query? for
example

$result = 'select * from building where size > 120 ';

from you code sample below , $_GET['afznr'] contain only 1 value. but
$result may contain more than 1 values. So what should i do?can i do like
this-

$node->nodeValue = '"afz_nr" = '$result'';

thanks


Willem Schwarte wrote:
> 
> 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
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Simple-Query.-How-to.-tp1808729p2149157.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list