[fdo-users] Creating a spatial filter

Dan Stoica dan.stoica at autodesk.com
Tue Dec 4 11:53:21 EST 2007


Hi,

Use a IPolygon instead of IEnvelope.

Dan.

-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of simon hope
Sent: Tuesday, December 04, 2007 2:08 AM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] Creating a spatial filter


Hello,

I'm attempting to create a spatial filter against an SDE FeatureClass. I'm
hitting a problem with the code below:

            byte[] byteArray;
            OSGeo.FDO.Geometry.IGeometry geom;
            OSGeo.FDO.Geometry.IEnvelope env;
            OSGeo.FDO.Geometry.FgfGeometryFactory geomFactory = new
OSGeo.FDO.Geometry.FgfGeometryFactory();
            OSGeo.FDO.Expression.Identifier qryPropName;

            try
            {

            //set the geometry fields
            qryPropName = new OSGeo.FDO.Expression.Identifier("shape");

            //create a geometry from an envelope
            env =
geomFactory.CreateEnvelopeXY(1765068.119,5916635.233,1765756.4,5917101.847);
            geom = geomFactory.CreateGeometry(env);

            //create the byte array required to create the expression
            byteArray = geomFactory.GetWkb(geom);
            OSGeo.FDO.Expression.GeometryValue qryGeomVal = new
OSGeo.FDO.Expression.GeometryValue(byteArray);

            //create the filter
            OSGeo.FDO.Filter.Filter fltr;
            fltr = new OSGeo.FDO.Filter.SpatialCondition(qryPropName,
OSGeo.FDO.Filter.SpatialOperations.SpatialOperations_Intersects,
qryGeomVal);

            //set the filter on the query command
            qrySelect.SetFilter(fltr.ToString());

            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                //todo clean up
            }

the code falls over when i try and SetFilter - giving me an error:
{"'FdoFgfGeometryFactory::CreateGeometryFromFgf': Unknown geometry type
'769' discovered. "}

I've managed to create attribute filters, and have tried to follow that
pattern for a spatial filter - should I be creating a specific geometry
type?

Any ideas?

Cheers

Simon
--
View this message in context: http://www.nabble.com/Creating-a-spatial-filter-tf4941500s18162.html#a14145736
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