[mapguide-users] MgSelection.AddFeatures Bug?

Buscher, Shane Shane.Buscher at nngco.com
Tue Mar 13 17:21:54 EDT 2007


I'm simply trying to highlight selected features based on an attribute
query. When I obtain a feature reader I check to make sure that there
are items in it, then I execute the MgSelection.AddFeatures method.
Nothing gets selected in the long run after I call the
SetSelectionXML('xml') viewer api function and refresh the map.  I took
a look at the xml being passed and noticed there are no records in it.
Is there something I'm doing wrong here?  There are definitely records
in the feature reader that aren't making it into the xml.  Or maybe
there's a bug in the MgSelection.AddFeatures() method?  Any help would
be greatly appreciated.

Regards,

Shane

Dim layer As MgLayer = _map.GetLayers.GetItem(0)
Dim className As String = layer.GetFeatureClassName
Dim resourceId As New MgResourceIdentifier(layer.GetFeatureSourceId)

Dim queryString As String
Dim queryOption As New MgFeatureQueryOptions()
queryOption.SetFilter(queryString)

Dim featureReader As MgFeatureReader
featureReader = _featureService.SelectFeatures(resourceId, className,
queryOption)

Dim i As Integer = 0
While featureReader.ReadNext
   i = i + 1
End While

If i > 0 Then
   Dim selection As New MgSelection(_map)
   selection.AddFeatures(layer, featureReader, 0)
   Dim xml As String = selection.ToXml()
End If

<?xml version="1.0" encoding="UTF-8"?>
<FeatureSet xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"></FeatureSet>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070313/07e98d88/attachment.html


More information about the mapguide-users mailing list