[fdo-users] FDO 3.1 vs 3.2
Gavin Cramer
gavin.cramer at autodesk.com
Wed Jan 2 14:43:42 EST 2008
Hello, George. The geometry type package supports Z and M. However, MySQL does not. The MySQL Provider denotes this by only reporting XY as the supported dimensionality in the FdoIGeometryCapabilities::GetDimensionalities method.
I would guess that an extra check has been added, rather than letting it quietly "succeed" with invalid data. I am not sure exactly where your error originates in the provider, but I only see this error being issued from FdoRdbmsFeatureReader::GetGeometry (and FdoRdbmsSQLDataReader). One would not expect a reader, as the return value from an Insert command, to be carrying geometry. If that's where it is coming from anyway, there could stand to be an improvement by catching it before the Insert can execute.
Regardless, what you have now is correct for MySQL, since it only supports XY. If your application will target other kinds of datastores, it would do well to check GetDimensionalities to make sure that the desired dimensionality is supported. If you need a handy tool to add or remove dimensions, take a look at FdoSpatialGeometryConverter.
Gavin
-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of George McLean
Sent: Wednesday, January 02, 2008 2:18 PM
To: FDO Users Mail List
Subject: Re: [fdo-users] FDO 3.1 vs 3.2
I just thought I would follow up with a fix for the unsupported geometry
type error I was getting. This may already be well known but I thought
someone might benefit from my experience. From what I can tell osgeo.fdo
geometry types do not support Z or M in the definition of the geometry.
I changed the dimensionality in the call to gf.CreatePoint from 2 which
gave me XYZM to 0 which gave me XY. This also worked with the call to
CreateLineString.
George
George McLean wrote:
> Hello,
>
> I am finally getting around to updating a .NET application to run in
> Map 2008 so I am running into some issues using the FDO 3.2 libraries.
> In the code below I am using the MySQL provider to insert point
> objects into a MySQL database. I get an error "Unsupported Geometry
> Type" for all my points using the following code.
>
> ' Load the geometry object
> Dim d(3) As Double
> d(0) = BlRef.Position.X
> d(1) = BlRef.Position.Y
> d(2) = BlRef.Position.Z
> Dim geoPoint As OSGeo.FDO.Geometry.IPoint
> geoPoint = gf.CreatePoint(3, d)
> Dim byteArray() As Byte
> byteArray = gf.GetFgf(geoPoint) ' gf.GetAgf(geoPoint)
> fdoGeoData = New OSGeo.FDO.Expression.GeometryValue(byteArray)
> fdoPropertyValue = New
> OSGeo.FDO.Commands.PropertyValue("geometry", fdoGeoData)
> fdoValueCollectionIndex = fdoPropertyValues.Add(fdoPropertyValue)
> ' Insert into FDO
> Dim fdoFeatureReader As osgeo.Fdo.Commands.Feature.IFeatureReader
> Try
>
> fdoFeatureReader = fdoInsertObject.Execute()
> fdoTrans.Commit()
> fdoFeatureReader.Dispose()
>
>
> This code was working fine using the appropriate FDO 3.1 libraries. I
> have similar code for loading LineString features that also fails in
> 3.2. Any suggestions on how to debug this?
>
> Thanks
>
> George McLean
> _______________________________________________
> 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
More information about the fdo-users
mailing list