Dear all,
I have problem in adding a point to an existing shapefile.
Running command.Execute, the following error is shown:
"'FdoPtr::operator->': Cannot execute function due to invalid value for the input parameter(s) 'p'. "
This is my code:
Dim connManager As OSGeo.FDO.IConnectionManager = OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager()
Dim conn As OSGeo.FDO.Connections.IConnection = connManager.CreateConnection("OSGeo.SHP.3.4")
conn.ConnectionString = "DefaultFileLocation=C:\WebSites\GeoT\userdata\Buffer.shp;"
conn.Open()
Dim command As IInsert = CType(conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert), IInsert)
Dim factory As New FgfGeometryFactory()
Dim position As IDirectPosition = factory.CreatePositionXYZ(1501015.85932722, 4431050.33027523, 0)
Dim point As IPoint = factory.CreatePoint(position)
command.PropertyValues.Add(New OSGeo.FDO.Commands.PropertyValue("FeatID", New Int32Value(5)))
command.PropertyValues.Add(New OSGeo.FDO.Commands.PropertyValue("Z", New DecimalValue(12)))
command.PropertyValues.Add(New OSGeo.FDO.Commands.PropertyValue("N", New DecimalValue(23)))
command.PropertyValues.Add(New OSGeo.FDO.Commands.PropertyValue("Geometry", New GeometryValue(factory.GetFgf(point))))
Try
Dim reader As IFeatureReader = command.Execute()
If reader.ReadNext() Then
End If
Catch ex As Exception
Finally
conn.Close()
End Try
Have you any idea?
F.