[Django] #31766: GDALRaster: return self on transformation

23 views
Skip to first unread message

Django

unread,
Jul 6, 2020, 6:20:04 AM7/6/20
to django-...@googlegroups.com
#31766: GDALRaster: return self on transformation
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Keywords: GDALRaster; GIS
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently the method GDALRaster.transform proceeds with the computation
even if the passed SRID is the same as the GDALRaster itself is in. I
would propose to just return self if a transformation like the following
is requested.
{{{
>> raster.srid
4326
>> raster.transform(4326)
}}}

This avoids unnecessary computation.

--
Ticket URL: <https://code.djangoproject.com/ticket/31766>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 6, 2020, 6:28:26 AM7/6/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* stage: Unreviewed => Accepted


Comment:

Thanks, IMO it's expected to return `self.clone()` is such cases.

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:1>

Django

unread,
Jul 6, 2020, 11:01:10 AM7/6/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Hasan Ramezani):

Does it need to implement `def clone` for `GDALRaster`? If so, should we
use `copy_ds` from `django.contrib.gis.gdal.prototypes` to copy the
`ds_input` and create a new `GDALRaster` object?

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:2>

Django

unread,
Jul 6, 2020, 11:01:23 AM7/6/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Hasan Ramezani):

* cc: Hasan Ramezani (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:3>

Django

unread,
Jul 7, 2020, 7:04:03 AM7/7/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* cc: Daniel Wiesmann (added)


Comment:

> Does it need to implement `def clone` for `GDALRaster`?

Yes.

> If so, should we use `copy_ds` from `django.contrib.gis.gdal.prototypes`
to copy the `ds_input` and create a new `GDALRaster` object?

Probably, I'm not an expert.

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:4>

Django

unread,
Jul 8, 2020, 12:50:50 PM7/8/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Srinivas
Type: | Reddy Thatiparthy
Cleanup/optimization | Status: assigned
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Srinivas Reddy Thatiparthy):

* owner: nobody => Srinivas Reddy Thatiparthy
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:5>

Django

unread,
Aug 21, 2020, 8:52:01 AM8/21/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Changes (by Srinivas Reddy Thatiparthy):

* owner: Srinivas Reddy Thatiparthy => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:6>

Django

unread,
Aug 30, 2020, 6:51:06 AM8/30/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
--------------------------------------+------------------------------------
Reporter: Riccardo | Owner: bartonip
Type: Cleanup/optimization | Status: assigned
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bartonip):

* owner: (none) => bartonip


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:9>

Django

unread,
Aug 30, 2020, 7:43:18 AM8/30/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: bartonip
Type: | Status: assigned

Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bartonip):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

Patch submitted: https://github.com/django/django/pull/13365

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:10>

Django

unread,
Aug 30, 2020, 8:18:10 AM8/30/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Barton Ip
Type: | Status: assigned

Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* stage: Ready for checkin => Accepted


Comment:

The PR should be first reviewed by reviewers and then they will change it
to [https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
tickets/#ready-for-checkin Ready for checkin] Stage.

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:11>

Django

unread,
Aug 31, 2020, 3:48:30 AM8/31/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Barton Ip
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:12>

Django

unread,
Sep 4, 2020, 7:35:51 AM9/4/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Barton Ip
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Barton Ip):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:13>

Django

unread,
Sep 8, 2020, 3:08:38 AM9/8/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Barton Ip
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GDALRaster; GIS | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* easy: 1 => 0


* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:14>

Django

unread,
Sep 11, 2020, 5:38:09 AM9/11/20
to django-...@googlegroups.com
#31766: Avoid unneccessary computation in GDALRaster.transform().
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: Barton Ip
Type: | Status: closed

Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution: fixed

Keywords: GDALRaster; GIS | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"12d6cae7c0401baa70c934f465bad856afecc847" 12d6cae]:
{{{
#!CommitTicketReference repository=""
revision="12d6cae7c0401baa70c934f465bad856afecc847"
Fixed #31766 -- Made GDALRaster.transform() return a clone for the same
SRID and driver.

Thanks Daniel Wiesmann for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31766#comment:15>

Reply all
Reply to author
Forward
0 new messages