Opened 4 years ago

Closed 4 years ago

#31766 closed Cleanup/optimization (fixed)

Avoid unneccessary computation in GDALRaster.transform().

Reported by: Riccardo Owned by: Barton Ip
Component: GIS Version: dev
Severity: Normal Keywords: GDALRaster; GIS
Cc: Hasan Ramezani, Daniel Wiesmann Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (11)

comment:1 by Mariusz Felisiak, 4 years ago

Summary: GDALRaster: return self on transformationAvoid unneccessary computation in GDALRaster.transform().
Triage Stage: UnreviewedAccepted

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

comment:2 by Hasan Ramezani, 4 years ago

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?

comment:3 by Hasan Ramezani, 4 years ago

Cc: Hasan Ramezani added

in reply to:  2 comment:4 by Mariusz Felisiak, 4 years ago

Cc: Daniel Wiesmann added

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.

comment:9 by Barton Ip, 4 years ago

Owner: set to Barton Ip
Status: newassigned

comment:10 by Barton Ip, 4 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:11 by Hasan Ramezani, 4 years ago

Triage Stage: Ready for checkinAccepted

The PR should be first reviewed by reviewers and then they will change it to Ready for checkin Stage.

comment:12 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:13 by Barton Ip, 4 years ago

Patch needs improvement: unset

comment:14 by Mariusz Felisiak, 4 years ago

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

comment:15 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 12d6cae:

Fixed #31766 -- Made GDALRaster.transform() return a clone for the same SRID and driver.

Thanks Daniel Wiesmann for the review.

Note: See TracTickets for help on using tickets.
Back to Top