#37179: Slicing a GDAL layer should scan layer once only
-------------------------------------+-------------------------------------
Reporter: wongcht | Owner: wongcht
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: gdal | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by wongcht:
Old description:
> In `django.contrib.gis.gdal.layer`'s `Layer.__getitem__`, if a layer
> (with **n** features) **does not support random read**, slicing the layer
> would call `_make_feature` at most **n** times which this method scan the
> whole layer until feature id matched.
>
> E.g. Slicing a layer for 3 features (id= 1,2,3) would scan the layer 3
> times: [1] for id=1, [1,2] for id=2, [1,2,3] for id=3. Worse case would
> call `__iter__` (`capi.get_next_feature`) for **n(n+1)/2** times
>
> A better iteration should scan the layer once only to get all features
> required. A possible [https://github.com/wongcht/django/pull/2/changes
> fix] FYR
New description:
In `django.contrib.gis.gdal.layer`'s `Layer.__getitem__`, if a layer (with
**n** features) **does not support random read**, slicing the layer would
call `_make_feature` at most **n** times which this method scan the whole
layer until feature id matched.
E.g. Slicing a layer for 3 features (id= 1,2,3) would scan the layer 3
times: [1] for id=1, [1,2] for id=2, [1,2,3] for id=3. Worst case would
call `__iter__` (`capi.get_next_feature`) for **n(n+1)/2** times
A better iteration should scan the layer once only to get all features
required. A possible [https://github.com/wongcht/django/pull/2/changes
fix] FYR
--
--
Ticket URL: <https://code.djangoproject.com/ticket/37179#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019edf90624e-cfa9db03-8a1d-4491-a944-76c00c34b014-000000%40eu-central-1.amazonses.com.