[mapguide-users] Problem with setFilter when making a selection

gawaine nicola.racco at gmail.com
Tue Apr 7 04:37:45 EDT 2009


Hi all, 
I have a problem with a ZoomToFeature technique. I use this code to make a selection of a feature:

MgUserInformation userInfo = new MgUserInformation(sessionId);
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgMap map = new MgMap(siteConnection);
map.Open(mapName);
MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
queryOptions.SetFilter("FeatId = " + fid);
MgLayerBase layer = map.GetLayers().GetItem(layerName);
MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
MgSelection selection = new MgSelection(map);
selection.AddFeatures(layer, featureReader, 0);
selectionXml = selection.ToXml();

Now, I have two layouts, the first loads feature properties from a shapefile, the second from a MySql database. In both layouts all features have an integer property called 'FeatId'.
If I use this code with the first layout (properties loaded from a shapefile), it works greatfully.
If I use this code with the second layout (properties loaded from database), selectionXml is always empty (it contains only a <FeatureSet> node, without childs).

Where is my error ? I also tried to update the mapguide fdo drivers from 3.3.0 to 3.3.2 and to use a different database (Microsoft SQL Server), but the result is always the same.
-- 
View this message in context: http://n2.nabble.com/Problem-with-setFilter-when-making-a-selection-tp2597720p2597720.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list