-
Notifications
You must be signed in to change notification settings - Fork 650
PostGIS Rasters Support
-
Install Mapnik with PostGIS Raster plugin support (2.3.x + pull-request) https://github.com/mapnik/mapnik/pull/2288
-
Allow specifying column name in grainstore: https://github.com/CartoDB/grainstore/issues/92 (already pushed to master branch, not in any official release)
-
Allow specifying column type in grainstore:
See https://github.com/CartoDB/grainstore/issues/93
READY https://github.com/strk/grainstore/tree/pgraster | https://github.com/CartoDB/grainstore/pull/95
Example https://github.com/strk/grainstore/blob/pgraster/test/mml_builder_multilayer.js#L150-L158
-
Allow specifying band number in grainstore. When using a raster-colorizer style the mapnik plugin must be configured to specify the band number to use for the raster data. Not specifying a band number would result in the plugin interpreting the data as a grayscale value.
READY https://github.com/strk/grainstore/tree/pgraster | https://github.com/CartoDB/grainstore/pull/95
Example https://github.com/strk/grainstore/blob/pgraster/test/mml_builder_multilayer.js#L198-L211
-
Allow specifying column name in MapConfig: https://github.com/CartoDB/Windshaft/issues/191 (pushed in a "pgraster" branch already)
-
Allow specifying column type in MapConfig: https://github.com/CartoDB/Windshaft/issues/190
-
Allow specifying band number in MapConfig
-
Create raster overviews on import The importer should find out how many overviews to create, based on the original raster size. This is the
-l 2,4,8,...
switch of raster2pgsql. See Automatic raster overviews -
Set raster constraints on import This is the
-C
switch of raster2pgsql, constraints are needed to get to know the scale of each available overview -
Remove tiles only composed by NODATA values
DON'T as this has 2 drawbacks: (1) users won't have a place to write new data into (2) adding visual interpretation of NODATA values would leave gaps on the map.
-
Ensure rasters are projected to webmercator before import. NOTE: raster2pgsql would need to be passed rasters that are already in webmercator.
Example gdalwarp -t_srs epsg:3857 raster.tif raster-wm.tif
-
Ensure rasters are perfectly aligned to the webmercator grid before import. This includes scaling and padding. NOTE: a slightly higher resolution scale is to be preferred over a slightly lower one. See Aligning Rasters to Webmercator grid
-
Import raster in tiles of 128x128, defining constraints and adding indexes. Example:
raster2pgsql -t 128x128 -C -I -Y -s 3857 -l 2,4,8,16 HYP_HR-wm-al.tif
. -
For single-band rasters, create indexes on min/max values. Doing so would greatly speedup the queries to fetch min/max pixel values for use by a raster colorizer wizard:
select min( min(st_summarystats(rast,1)) ), max( max(st_summarystats(rast,1)) ) from hyp_1250m;
This could maybe be done lazily by the wizard on a as-needed basis.
** Example **
create index on hyp_1250m ( min(st_summarystats(rast,1)) ); create index on hyp_1250m ( max(st_summarystats(rast,1)) );
-
Grant SELECT on raster_columns and raster_overviews views to public
-
Have GRANTS on raster overview tables follow grants on main tables
If a user sets a raster table to public, then all its overviews should become public too
-
Recognize raster columns in user tables, creating maps accordingly
-
Implement wizards for raster styling - includes recognizing if a raster has to be threated as containing RGB(A), Grayscale(A) or Data, see https://github.com/mapnik/mapnik/wiki/RFC:-Raster-color-interpretation