[mapguide-users] Update SHP properties

sekko970 fabio.franceschini at techneteam.it
Mon Oct 18 05:59:37 EDT 2010


I need to update the properties of objects in a shapefile.

I select an object using a filtered FeatureReader, and update each property.

It works fine for each property type, but not when a property has type
"Decimal":
in this case FeatureReader get the type MgPropertyType.Double, so I set an
MgDoubleProperty, but the new value is not saved and no exceptions are
returned.

I'm using MG 2.0.2.


Dim query As New MgFeatureQueryOptions()
query.SetFilter(filter)
featureReader = featureSrvc.SelectFeatures(myFeatureSourceId,
myFeatureClassName, query)
featureReader.ReadNext()
...
Dim mgProps As New MgPropertyCollection
For p As Integer = 0 To featureReader.GetPropertyCount - 1
    Dim mgProp As MgProperty = Nothing
    Select Case
featureReader.GetPropertyType(featureReader.GetPropertyName(p))
        ...
        Case MgPropertyType.Double
            mgProp = New MgDoubleProperty(k, CType(newValue, Double))
        ...
    End Select
    mgProps.Add(mgProp)
Next
featureReader.Close()

Dim commands As New MgFeatureCommandCollection()
commands.Add(New MgUpdateFeatures(myClassName, mgProps, filter))
Call featureSrvc.UpdateFeatures(myFeatureSourceId, commands, False)


Thanks,
Fabio

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Update-SHP-properties-tp5646451p5646451.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list