I am working with OGR in Python and noticed that the C libraries have useful Intersection() and Clip() functions as part of the Layer class. Is there any way to get at these functions in Python? I know that these functions exist on the Geometry level but I'm looking specifically at the Layer. Thanks!
Answer
Yes. They are exposed in the bindings:
>>> from osgeo import ogr
>>> help(ogr.Layer.Intersection)
Help on method Intersection in module osgeo.ogr:
Intersection(self, *args, **kwargs) unbound osgeo.ogr.Layer method
Intersection(self, Layer method_layer, Layer result_layer, char options = None,
GDALProgressFunc callback = None, void callback_data = None) -> OGRErr
>>> help(ogr.Layer.Clip)
Help on method Clip in module osgeo.ogr:
Clip(self, *args, **kwargs) unbound osgeo.ogr.Layer method
Clip(self, Layer method_layer, Layer result_layer, char options = None,
GDALProgressFunc callback = None, void callback_data = None) -> OGRErr
I am guessing you need GEOS support built into GDAL and confirmed:
http://gdal.org/ogr/classOGRLayer.html#ac189f54996c2d6fd769889ec99e0f48a
and
http://gdal.org/ogr/classOGRLayer.html#a56d7ee3b2020e53c730d67ee4f1e2fb6
No comments:
Post a Comment