[mapguide-users] Filtering features on map with SelectFeatures function

FGoulet gouletf at dfo-mpo.gc.ca
Tue Apr 3 13:10:24 EDT 2007


Thanks, I was looking at that solution too.

I did successfuly change the layer definition but I have not be able to save
it back to the map in the user session yet...

I will push in that direction...

Frederic




You'll probably want to modify the Filter element of the LayerDefinition  
so that the layer displays only your desired objects. The code below does  
that for one of our maps, but it isn't a very good example because it  
updates the Library resource rather than the layer in the Session  
repository.

  
$QueryFilter='Drawing+%3D+%26apos%3B74%26apos%3B+AND+Dept+%3D+%26apos%3B136%26apos%3B'
   // Load the Query Match Layer Definition template into a PHP DOM object  
and
   // modify its Filter node so we're displaying the right building and  
floor.
   $doc = DOMDocument::load('QueryMatch.LayerDefinition.xml');
   $FilterNode = $doc->getElementsByTagName('Filter')->item(0);
   $FilterNode->nodeValue = $QueryFilter;
   $LayerDefinition = $doc->saveXML();
   $byteSource = new MgByteSource($LayerDefinition,  
strlen($LayerDefinition));
   $byteSource->SetMimeType(MgMimeType::Xml);
   $tempResourceID = new  
MgResourceIdentifier("Library://HumboldtFM/Layers/QueryMatch.LayerDefinition");
   $resourceService->SetResource($tempResourceID, $byteSource->GetReader(),  
null);

-- 
James Card
California CAD Solutions, Inc.
209 578-5580
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



-- 
View this message in context: http://www.nabble.com/Filtering-features-on-map-with-SelectFeatures-function-tf3486952s16610.html#a9818609
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list