[postgis-devel] PostGIS 3 thought experiment

Olivier Courtin olivier.courtin at gmail.com
Wed Jan 31 08:01:19 PST 2018


Hi Bborie,


> How're you doing the conversion between Raster and Numpy ndarray ?
> I haven't need to do this myself yet but I'd think ST_DumpValues would do it.

Several ways to already do it,

The one i use for now is:

https://github.com/nathancahill/wkb-raster

on SQL side:
SELECT ST_Binary(rast) ...

on Python side:
read_wkb_raster(BytesIO(line.label))['bands'][0]['ndarray']


But i guess/hope we could perform the conversion quicker,
and add the reverse one, NumPy ndarray to Raster, too.




And maybe as you already wishlist to improve/enhance Raster
serialization itself, in 3.0,
we could -maybe- imagine something agnostic enough to allow a very
thin conversion overhead.

O.


More information about the postgis-devel mailing list