[gdal-dev] Intersection of two Layers

Ari Jolma ari.jolma at gmail.com
Sat Jan 23 02:29:07 PST 2016


I've committed the enhancement to the trunk.

The new options are USE_PREPARED_GEOMETRIES, which defaults to YES, and 
PRETEST_CONTAINMENT (note the change in this key), which defaults to NO.

Prepared geometries are used in Intersection, Union, and Identity.

Ari

22.01.2016, 15:06, Kai Muehlbauer kirjoitti:
> 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
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160123/b8e1df8e/attachment.html>


More information about the gdal-dev mailing list