[gdal-dev] Intersection of two Layers

Kai Muehlbauer kai.muehlbauer at uni-bonn.de
Fri Jan 22 05:06:48 PST 2016


Here is the code.

Am 22.01.2016 um 14:05 schrieb Kai Muehlbauer:
> Am 22.01.2016 um 13:26 schrieb Even Rouault:
>> Le vendredi 22 janvier 2016 13:19:40, Kai Muehlbauer a écrit :
>>> Am 22.01.2016 um 12:58 schrieb Ari Jolma:
>>>> 22.01.2016, 13:49, Kai Muehlbauer kirjoitti:
>>>>> This is very good news! If I understand correctly, I could use your
>>>>> patch and self-compile gdal to have access to the improved
>>>>> layer-intersection function via the python bindings. I'll give this a
>>>>> try.
>>>>
>>>> Attached is probably a bit better diff.
>>>>
>>>> As I wrote, similar thing should be done for other layer methods.
>>>>
>>>> Yes, you can use this with the trunk version.
>>>
>>> Thanks Ari, I keep you posted. If I get this running, I'm also available
>>> for testing the other changes.
>>
>> Kai, just thinking: do you have spatial indices defined, especially on
>> the
>> method layer ? If not, that would be the first thing to do since for each
>> geometry in input layer, a spatial filter is set on method layer using
>> the
>> extent of the input geometry.
>
> Thanks for the comment Even, yes, I have a spatial filter in place. But
> with prepared geometries it takes only 50% of the time. Attached you
> find my (stripped) python code:
>
> Method 1 is more or less what I do. In my example this takes 35 seconds.
>
> Method 2 I implemented with shapely prepared geometry. This runs only
> ~17 seconds on the same machine.
>
> If I call layer.Intersection(method, dst, options) directly it takes ~55
> seconds.
>
> So with the prepared geometries we get 70% improvement. And 50%
> improvement compared to the iteration over layer method.
>
> And, without SpatialFilter this will run almost forever.
>
> Thanks again for your comments, it's very much appreciated.
>
> Cheers,
> Kai
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Kai Muehlbauer
Meteorological Institute University of Bonn
Auf dem Huegel 20       | +49 228 739083
D-53121 Bonn            | kai.muehlbauer at uni-bonn.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_intersect.py
Type: text/x-python
Size: 999 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160122/5ffc47fb/attachment.py>


More information about the gdal-dev mailing list