Hi,

at the moment I calculate the intersection of two OGR Layers (A, B) by iterating over features/geometries (GA) of layer A and then calling GA.Intersection(GB) for every Feature/Geometry (GB) of B. I set a spatial filter for layer B with every GA. The intersections features/geometries are written to a result layer (C).

In my use case the features/geometries of layer B are much smaller than the features of layer A. Means that quite a big number of B's geometries are fully contained in A's geometries.

To speed things up, I check for containment GA.contains(GB). If GB is contained in GA, I just copy GB to C, otherwise I calculate GA.Intersection(GB) and write this to C.

I found that I also could use the layer intersection function (OGRLayer::Intersection). Unfortunately the intersection is calculated for every feature/geometry.

Would it be possible to extend the layer intersection function to allow for containment check (eg. as an option) and just copy the contained geometries without calculation of expensive intersection? Suggestions, opinions?

In my use case I get improvements of around 20% of processing time.

Cheers,
Kai
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to