[fdo-users] Insert new feature object on SHP File

Gavin Cramer gavin.cramer at autodesk.com
Mon Nov 2 00:51:27 EST 2009


It is good to see that you got your code working.

I noticed that you were providing a value for the ID property.  In SHP, I believe that the identifier is always auto-generated.  Perhaps the SHP Provider is not checking, but some providers are more strict and may throw an exception if you supply a value for an auto-generated property.

To find out whether a property is auto-generated, you can use the FdoIDescribeSchema command, and search the resulting object tree for the needed property.  The FdoDataPropertyDefinition:: GetIsAutoGenerated() method will say whether the property is auto-generated (in which case, it is best to not provide a value during an Insert).

Gavin


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Matteo
Sent: Sunday, November 01, 2009 4:39 PM
To: fdo-users at lists.osgeo.org
Subject: Re: [fdo-users] Insert new feature object on SHP File


Thanks a lot Jason. Now work fine.
Regards,
Matteo 

Jason Birch wrote:
> 
> I'm not an FDO coder, but there are a couple things I'd look at.
> 
> First, FDODimensionality isn't an integer value representing the number of
> dimensions, it's a bit-field enumeration. In this case, 2 evaluates to
> FdoDimensionality_M (although, since the value of FdoDimensionality_XY is
> 0,
> this is included by default in the evaluation of FdoDimensionality_M -
> neat).
> 
> http://fdo.osgeo.org/files/fdo/docs/FDO_API/d3/d95/group__enums_g3778ef9845e2ba00e8669c32ec42e113.htm#g3778ef9845e2ba00e8669c32ec42e113
> 
> Second, the docs for CreateLineString indicate that it's looking for the
> number of ordinates, not co-ordinates.  I'm not sure if this is just a
> terminology issue, but perhaps it is looking for 6 in your case.
> 
> http://fdo.osgeo.org/files/fdo/docs/FDO_API/d1/d7d/class_fdo_fgf_geometry_factory_0e122ad008ada729f974e407aa1285dd.htm#0e122ad008ada729f974e407aa1285dd
> 
> Jason
> 
> 2009/11/1 Matteo <matteo.conte1979 at libero.it>
> 
>>
>> Hi all,
>>  I'm new on FDO. I try to insert a new feature object on a shp file with
>> VB.NET but i get this error "The type of geometry ( 'PolyLineM')
>> geographical entity creates a conflict with the type of shape file (
>> 'Polyline')."
>> This is the code:
>> Dim objCmdI As Commands.Feature.IInsert =
>> objConn.CreateCommand(Commands.CommandType.CommandType_Insert)
>>        objCmdI.SetFeatureClassName(objClass.Name)
>>        Dim objPropsValues As Commands.PropertyValueCollection =
>> objCmdI.PropertyValues()
>>        Dim objPropV As Commands.PropertyValue = New
>> Commands.PropertyValue()
>>        objPropV.SetName("ID")
>>        objPropV.Value = New OSGeo.FDO.Expression.Int32Value(2)
>>
>>
>>        objPropsValues.Add(objPropV)
>>        objPropV = New Commands.PropertyValue()
>>        objPropV.SetName("Geometry")
>>        Dim objGeomV As Geometry.FgfGeometryFactory = New
>> Geometry.FgfGeometryFactory()
>>
>>        Dim objCoords(5) As Double
>>        objCoords(0) = 0
>>        objCoords(1) = 0
>>        objCoords(2) = 10
>>        objCoords(3) = 10
>>        objCoords(4) = 50
>>        objCoords(5) = 20
>>
>>        Dim objLine As Geometry.ILineString = objGeomV.CreateLineString(2,
>> 3, objCoords)
>>
>>        objPropV.Value = New
>> OSGeo.FDO.Expression.GeometryValue(objGeomV.GetFgf(objLine))
>>        objPropsValues.Add(objPropV)
>>        objCmdI.Execute()
>>        objConn.Flush()
>>
>> Can you help me?
>> Regards,
>> Matteo
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Insert-new-feature-object-on-SHP-File-tp3928348p3928348.html
>> Sent from the FDO Users mailing list archive at Nabble.com.
>> _______________________________________________
>> fdo-users mailing list
>> fdo-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/fdo-users
>>
> 
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Insert-new-feature-object-on-SHP-File-tp3928348p3928709.html
Sent from the FDO Users mailing list archive at Nabble.com.
_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users


More information about the fdo-users mailing list