[fdo-users] Creating a spatial filter

simon hope simonh at geobiz.co.nz
Tue Dec 4 02:08:08 EST 2007


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.



More information about the fdo-users mailing list