Skip to content

Instantly share code, notes, and snippets.

@andrewharvey
Created September 29, 2012 02:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewharvey/3802964 to your computer and use it in GitHub Desktop.
Save andrewharvey/3802964 to your computer and use it in GitHub Desktop.
Geoscience Australia - Australian Bathymetry and Topography Grid
#!/bin/sh
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
mkdir -p downloads-zip
#55722: Adobe PDF, Australian Bathymetry and Topography Grid, 2009 Report
#55724: ER Mapper raster dataset, ER Mapper ers files
#55725: Tagged Image File Format (TIFF), ER Mapper Raster images
#55726: ESRI Grid Files
#55728: Reports, Metadata and Text files
wget -O - 'https://www.ga.gov.au/products/servlet/controller?product_id=55722&product_id=55728&product_id=55724&sector=General+public&occupation=Spatial+information+services&email=&co=Continue+to+File+Download+-%3E&event=FILE_LISTING' | \
grep 'DOWNLOAD_FILE' | grep -o "\"[^\"]*\"" | sed 's/^"/https:\/\/www.ga.gov.au/' | sed 's/"$//' | \
wget -i - --directory-prefix=downloads-zip --trust-server-names --no-clobber
#!/bin/sh
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
for f in downloads-zip/*.zip ; do
z=`basename "$f" .zip`;
mkdir -p "downloads-unzip/$z";
unzip -n -d "downloads-unzip/$z" "$f";
done
#!/bin/sh
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
# This process follows http://mapbox.com/tilemill/docs/guides/terrain-data/
# reproject to slippy map projection
gdalwarp -t_srs "EPSG:900913" -r near -of VRT downloads-unzip/ER_Mapper_ers/ER_Mapper_ers/ausbath_09_v4_ex_ex.ers ausbath_09_v4_ex_ex.vrt
# prepare the color ramp for gdaldem from the QGIS color ramp export
cat stylesheets/ausbath-color-ramp.txt | tail -n +3 | cut -d',' -f1-4 --output-delimiter=' ' > stylesheets/ausbath-color-ramp.gdaldem.txt
mkdir -p layers
# make the color relief image
nice gdaldem color-relief ausbath_09_v4_ex_ex.vrt stylesheets/ausbath-color-ramp.gdaldem.txt layers/ausbath_09_v4_color_relief.tiff -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9
# remove autogenerated gdaldem color relief color ramp
rm -f stylesheets/ausbath-color-ramp.gdaldem.txt
# make the hillshaded greyscale image
nice gdaldem hillshade ausbath_09_v4_ex_ex.vrt layers/ausbath_09_v4_hillshade.tiff -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9
# generate slope for the slopeshade
nice gdaldem slope ausbath_09_v4_ex_ex.vrt layers/ausbath_09_v4_slope.tiff -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9
# generate the slopeshade
nice gdaldem color-relief layers/ausbath_09_v4_slope.tiff stylesheets/slope-ramp.txt layers/ausbath_09_v4_slopeshade.tiff -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9
# we only needed this to generate the slopeshade, so remove it now
rm -f layers/ausbath_09_v4_slope.tiff
# add a link to the layers within the stylesheets directory for the mapnik stylesheet
ln -s -T ../layers stylesheets/layers

About

This package contains a set of tools, utilities and stylesheets for working with the Geoscience Australia Australian Bathymetry and Topography Grid.

Here is a sample rendering of this Geoscience Australia Australian Bathymetry and Topography Grid using the process documented in this repository.

Australian Bathymetry and Topography Grid

License

All scripts and files within this repository are licensed as follows.

To the extent possible under law, the person who associated CC0
with this work has waived all copyright and related or neighboring
rights to this work.
http://creativecommons.org/publicdomain/zero/1.0/

The Bathymetry and Topography Grid from Geoscience Australia, according to the document in reports_metadata_files.zip/reports and text files/copyright.txt, is licensed as follows.

© Commonwealth of Australia (Geoscience Australia) 2009.
This material is released under the Creative Commons Attribution 2.5 Australia Licence.
http://creativecommons.org/licenses/by/2.5/au/

However you should approach this with caution because several of the datasets which were used to build the Bathymetry and Topography Grid product are released under a non compatible license (CIAT-CSI SRTM). It remains unclear if Geoscience Australia has obtained a license from CGIAR to make use of this material and release derivative works under the Creative Commons Attribution 2.5 Australia Licence.

Dependencies

To run through all the steps provided by these script you will need,

gdal-bin, unzip

Downloading the Dataset

You can download the Reference documents and Bathymetry and Topography Grid files using,

./scripts/01-download.sh

The grid is provided in several formats. This script uses the ERS file.

Unzipping

To unzip these downloads run,

./scripts/02-unzip.sh

Pre-Process

The next step will generate three rasters, as required by the ausbath-hillshaded-color-relief.xml Mapnik stylesheet (color relief, hillshade and slopeshade).

./scripts/03-generate-images.sh

Previewing the Mapnik Style

There are many ways to use the Mapnik stylesheet. If you just want to preview it locally then liteserv may be your best option.

There is a live preview of this stylesheet.

# QGIS Generated Color Map Export File
INTERPOLATION:INTERPOLATED
-8764,0,0,0,255,Lowest Point in Map Extent
-4000,3,45,85,255,
-100,0,101,199,255,
-10,192,224,255,255,
0,108,220,108,255,Sea Level
55,50,180,50,255,
390,240,250,150,255,
835,190,185,135,255,
1114,180,128,107,255,
1392,235,220,175,255,
2228,215,244,244,255,Highest Point in Australia
4000,255,255,255,255,Highest Point in Map Extent
<?xml version="1.0" encoding="utf-8"?>
<!--
To the extent possible under law, the person who associated CC0
with this work has waived all copyright and related or neighboring
rights to this work.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
<!-- Later mapnik versions use comp-op rather than mode -->
<Style name="ausbath-slopeshade">
<Rule>
<RasterSymbolizer scaling="bilinear" opacity="0.4" mode="multiply">
</RasterSymbolizer>
</Rule>
</Style>
<Style name="ausbath-hillshade">
<Rule>
<RasterSymbolizer scaling="bilinear" opacity="0.7" mode="multiply">
</RasterSymbolizer>
</Rule>
</Style>
<Style name="ausbath-color-relief">
<Rule>
<RasterSymbolizer scaling="bilinear">
</RasterSymbolizer>
</Rule>
</Style>
<Layer name="ausbath-color-relief">
<StyleName>ausbath-color-relief</StyleName>
<Datasource>
<Parameter name="file">layers/ausbath_09_v4_color_relief.tiff</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
<Layer name="ausbath-hillshade">
<StyleName>ausbath-hillshade</StyleName>
<Datasource>
<Parameter name="file">layers/ausbath_09_v4_hillshade.tiff</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
<Layer name="ausbath-slopeshade">
<StyleName>ausbath-slopeshade</StyleName>
<Datasource>
<Parameter name="file">layers/ausbath_09_v4_slopeshade.tiff</Parameter>
<Parameter name="type">gdal</Parameter>
</Datasource>
</Layer>
</Map>
"ga-ausbath-hill-slope-shaded-relief":
{
"provider":
{
"name": "mapnik",
"mapfile": "ausbath-hillshaded-color-relief.xml"
},
"metatile":
{
"rows": 8,
"columns": 8,
"buffer": 0
},
"bounds":
{
"north": -8.00243896141213,
"west": 91.9976220697805,
"south": -60.0028338620231,
"east": 171.9974601982,
"high": 10,
"low": 0
},
"preview":
{
"lat": -40,
"lon": 146.3,
"zoom": 7
},
"redirects": {"png": "jpg"}
},
#!/bin/sh
mapnik_render_static_map.py --mapfile stylesheets/ausbath-hillshaded-color-relief.xml -x 150.97137 -y -33.92627 -z 9 --width 1000 --height 600 -o preview.jpg
0 255 255 255
90 0 0 0
#!/bin/sh
nice tilestache-seed --config /etc/tilestache.cfg --layer ga-ausbath-hill-slope-shaded-relief --bbox -8.00243896141213 91.9976220697805 -60.0028338620231 171.9974601982 --output-directory /var/cache/tilestache/ --enable-retries --extension jpg {0..10}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment