[gdal-dev] Intersection of two Layers

Ari Jolma ari.jolma at gmail.com
Fri Jan 22 01:52:26 PST 2016



22.01.2016, 10:06, Kai Muehlbauer kirjoitti:
>
>
> To quickly check if there is an improvement I used the python shapely 
> package. Converting the outer loop geometry to an shapely prepared 
> geometry and calling 'contains()' with the inner loop geometries to 
> find those fully contained geometries I get an improvement of nearly 
> 40% to the former ogr only code.
>
> As Even pointed out, there is only OGRPreparedGeometryIntersects() 
> (GEOSPreparedIntersects) exposed within ogrgeometry.cpp. In my use 
> case I would need GEOSPreparedContains to mimic the shapely behaviour.

I made a small test with the attached diff, which prepares the 
geometries of the input layer.

The input layer had two polygons (boundaries of two Finnish 
municipalities) and the method layer had 3091 points, all in either one 
of the polygons.

The improvement is ~15%.

I think the prepared geometries could be used by default easily. 
Prepared contains test would need addition of the respective GEOS method.

Ari

>
> Next thing is that the ogr SWIG python bindings do not wrap those 
> available OGRPrepared-functions.
>
> I'm no expert when it comes to c/c++-python interaction to create a 
> patch to have this functionality within python ogr/gdal. So hoping for 
> help in this matter, I'm asking for suggestions how to get the 
> GEOSPreparedGeometry stuff called from OGR.
>
> Cheers,
> Kai
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: prepared.diff
Type: text/x-patch
Size: 2064 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160122/2797f462/attachment.bin>


More information about the gdal-dev mailing list