[fdo-users] Add point to SHP file

Jackie Ng jumpinjackie at gmail.com
Fri Nov 6 07:07:23 EST 2009


You haven't specified the feature class the insert command will be inserting
into.

- Jackie


sekko970 wrote:
> 
> 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.
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Add-point-to-SHP-file-tp3958152p3958317.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list