Opened 3 years ago

Closed 3 years ago

#32670 closed New feature (fixed)

django.contrib.gis.GDALRaster support for vsi filesystems

Reported by: Jordi Castells Owned by: Jordi Castells
Component: GIS Version: 4.0
Severity: Normal Keywords: raster
Cc: 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

The GDAL library has out of the box support for different kinds of virtual filesystems (directly accessing data on ZIP, or networked filesystems).

https://gdal.org/user/virtual_file_systems.html

Those specific filesystems are enabled with a string prefix to the path sent to GDAL when instantiating a new raster.

django.contrib.gis.GDALRaster does not support any of this special cases since it forces any string to either be an in memory gdal vsi path (strating with /vsimem) or an existing path in the filesystem.

So for example, gdal will happily open /vsizip//tmp/raster.zip but django.contrib.gis.GDALRaster will refuse to do so even though the underlying library supports it.

There are other specific cases that might benefit from it, for example a Cloud Optimized GeoTiff (COG) stored in an S3 file service. To read that raster into Django one has to download it first to the filesystem (or memory) and then pass it to GDALRaster beating the purpose of the COG in S3, while a /vsis3 path can instantiate that COG file and just retrieve the data as needed thus reducing network usage.

This could probably be a whole other discussion here on how to treat those kind of files in a less "gdaly" way (for example with specific django.contrib.gis.GDALRaster driver option, similar to the current driver=MEM). But a first straightforward step that would open those functionalities to djangogis is simply to let those /vsi* paths through instead of failing.

Change History (7)

comment:1 by Mariusz Felisiak, 3 years ago

Cc: Daniel Wiesmann added
Keywords: raster added
Triage Stage: UnreviewedAccepted
Version: 3.24.0

comment:2 by Mariusz Felisiak, 3 years ago

comment:3 by Mariusz Felisiak, 3 years ago

Owner: changed from nobody to Jordi Castells

comment:4 by Mariusz Felisiak, 3 years ago

Needs documentation: set

comment:5 by Mariusz Felisiak, 3 years ago

Needs documentation: unset
Patch needs improvement: set

comment:6 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 205c36b5:

Fixed #32670 -- Allowed GDALRasters to use any GDAL virtual filesystem.

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