-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# mapnik-raster-colorizer | ||
|
||
Example of Mapnik raster colorizer | ||
|
||
## Usage | ||
|
||
docker-compose up --build -d | ||
|
||
## Raster dataset license | ||
|
||
[WorldPop](http://www.worldpop.org.uk/data/summary/?doi=10.5258/SOTON/WP00234) datasets | ||
are licensed under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) | ||
|
||
> Africa population count data: Linard, C., Gilbert, M., Snow, R.W., Noor, A.M. and Tatem, A.J., 2012, | ||
> Population distribution, settlement patterns and accessibility across Africa in 2010, PLoS ONE, 7(2): e31743. | ||
|
||
## License | ||
|
||
LGPL v2.1 [Same as Mapnik](https://github.com/mapnik/mapnik#license) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: "3" | ||
services: | ||
postgres: | ||
build: | ||
context: ./postgres | ||
environment: | ||
- POSTGRES_PASSWORD=sa | ||
volumes: | ||
- ./rasters:/rasters | ||
ports: | ||
- "5432:5432" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM mdillon/postgis:9.6 | ||
|
||
RUN set -ex; apt-get update && \ | ||
apt-get install -y gdal-bin && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
mkdir /rasters && \ | ||
chown postgres:postgres -R /rasters; | ||
|
||
COPY raster-import.sh /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
GEOTIFF="SLE10adjv4.tif" | ||
ARCHIVE="/rasters/SLE.tar.gz" | ||
DB_NAME="sierra_leone" | ||
|
||
if [[ ! -f "${ARCHIVE}" ]]; then | ||
exit 1; | ||
fi | ||
|
||
echo "CREATE DATABASE ${DB_NAME} TEMPLATE template_postgis" | psql -U postgres -h localhost | ||
|
||
cd /tmp | ||
|
||
tar xvfz "${ARCHIVE}" | ||
|
||
# Import - No transformation | ||
|
||
raster2pgsql -C -I -Y "${GEOTIFF}" -t 128x128 sle_pop | psql -U postgres -h localhost -d "${DB_NAME}" | ||
|
||
# Reproject and compress | ||
|
||
gdalwarp -ot Byte -co COMPRESS=LZW -t_srs EPSG:3857 "${GEOTIFF}" "sle-wm.tif" | ||
|
||
raster2pgsql -C -I -Y "sle-wm.tif" -t 128x128 sle_pop_wm | psql -U postgres -h localhost -d "${DB_NAME}" |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.