[Gdal-dev] How to use SetSpatialFilter()

Tamas Szekeres szekerest at gmail.com
Tue Nov 7 08:24:30 EST 2006


Hi,

If you would create a geometry from a WKT string you should not
specify the geom type explicitly, like:

Geometry geom = new Geometry(ogr.wkbUnknown, "POINT(47.0 19.2)", 0, null, null);

See the createdata.cs as a working example.


Best Regards,

Tamas Szekeres




2006/11/7, Mir Hassan Ali <mirhassanali at gmail.com>:
> Hi
>
> I am using the C# wrapper for GDAL in my application. I want to use
> SetSpatialFilter() method on a layer. I have an area defined by the
> coordinates
> <extent>
>
>
>        <type> area</type>
>
>        <coord-string>
> 393546-377079;393544-377081;393542-377079;393544-377077</coord-string>
> </extent>
>
> I am trying to set this area as spatial filter for the layer by using the
> following code
>
> layer.SetSpatialFilter(new Geometry(ogr.wkbGeometryCollection ,
> "RECTANGLE(393546 377079 393544 377081 393542 377079 393544 377077)", 0,
> null, null));
>
> But doing this does not return the desired result. It returns feature count
> as zero, rather than returning the features. Could someone please guide me
> how to use this function correctly.
> I apologise for asking such a basic question, but I am new to the GIS stuff
> so I hope you won't mind.
> Any help will be appreciated.
>
> Best Regards
>
> Mir Hassan Ali
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>
>



More information about the Gdal-dev mailing list