[fdo-users] Creating a spatial filter

simon hope simonh at geobiz.co.nz
Mon Dec 10 14:46:49 EST 2007


So far I've been using the windows binaries only  - I'm assuming the unit
tests are part of the source packages.

Simon



Dan Stoica wrote:
> 
> In general when in doubt or looking for snippets, your best bet is the
> unit tests. At least this is my approach :-)
> 
> 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: Sunday, December 09, 2007 3:08 PM
> To: fdo-users at lists.osgeo.org
> Subject: RE: [fdo-users] Creating a spatial filter
> 
> 
> Gavin,
> 
> Thanks for the advice that worked - here is the code for completeness:
> 
>             //set the geometry fields
>             qryPropName = new OSGeo.FDO.Expression.Identifier("shape");
> 
>             //create a geometry from a poly
>             poly =
> (OSGeo.FDO.Geometry.IPolygon)geomFactory.CreateGeometry("POLYGON((176954.045
> 5914119.79, 1769564.823 5914473.302, 1770089.64 5914474.08, 1770091.198
> 5914117.454, 176954.045 5914119.79))");
>             geom = geomFactory.CreateGeometry(poly);
> 
>             //create the byte array required to create the expression
>             byteArray = geomFactory.GetFgf(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());
> 
> Cheers
> 
> Simon
> 
> 
> Gavin Cramer wrote:
>>
>> Hi, Simon.  Instead of GetWkb, use GetFgf.  FGF is the binary storage
>> format for FDO geometries.
>>
>> Gavin
>>
>>
>> -----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 9:44 PM
>> To: fdo-users at lists.osgeo.org
>> Subject: RE: [fdo-users] Creating a spatial filter
>>
>>
>> Hi Dan,
>>
>> I tried the following:
>>
>>             //set the geometry fields
>>             qryPropName = new OSGeo.FDO.Expression.Identifier("shape");
>>
>>             //create a geometry from a poly
>>             poly =
>> (OSGeo.FDO.Geometry.IPolygon)geomFactory.CreateGeometry("POLYGON((176954.045
>> 5914119.79, 1769564.823 5914473.302, 1770089.64 5914474.08, 1770091.198
>> 5914117.454, 176954.045 5914119.79))");
>>             geom = geomFactory.CreateGeometry(poly);
>>
>>             //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());
>>
>> And I get the same issue - I also tried creating the byteArray directly
>> from
>> the poly object i.e.
>>
>> byteArray = geomFactory.GetWkb(poly);
>>
>> But i get the same message - is it advisable to use this method to create
>> polygons? i.e from a WKT or is it better to use LinearRings?
>>
>> Cheers
>>
>> Simon
>>
>>
>> Dan Stoica wrote:
>>>
>>> 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
>>> _______________________________________________
>>> fdo-users mailing list
>>> fdo-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/fdo-users
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Creating-a-spatial-filter-tf4941500s18162.html#a14164229
>> 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://www.nabble.com/Creating-a-spatial-filter-tp14145736s18162p14242581.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://www.nabble.com/Creating-a-spatial-filter-tp14145736s18162p14260123.html
Sent from the fdo-users mailing list archive at Nabble.com.



More information about the fdo-users mailing list