{"id":16820615,"url":"https://github.com/andrewharvey/srtm-stylesheets","last_synced_at":"2025-10-30T17:37:35.055Z","repository":{"id":4952972,"uuid":"6110336","full_name":"andrewharvey/srtm-stylesheets","owner":"andrewharvey","description":"Shell scripts for working with NASA SRTM DEM data; gdaldem stylesheets for shaded relief maps; Mapnik stylesheets for contours; TileStache configuration for sandwich","archived":false,"fork":false,"pushed_at":"2015-01-09T21:48:49.000Z","size":269,"stargazers_count":55,"open_issues_count":2,"forks_count":12,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-12-30T05:43:09.191Z","etag":null,"topics":["contours","hill-shading","srtm-data"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"lapwinglabs/x-ray","license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewharvey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-07T07:32:55.000Z","updated_at":"2024-09-25T13:46:11.000Z","dependencies_parsed_at":"2022-09-16T19:11:14.325Z","dependency_job_id":null,"html_url":"https://github.com/andrewharvey/srtm-stylesheets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewharvey%2Fsrtm-stylesheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewharvey%2Fsrtm-stylesheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewharvey%2Fsrtm-stylesheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewharvey%2Fsrtm-stylesheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewharvey","download_url":"https://codeload.github.com/andrewharvey/srtm-stylesheets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233753246,"owners_count":18724821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contours","hill-shading","srtm-data"],"created_at":"2024-10-13T10:57:30.576Z","updated_at":"2025-10-30T17:37:30.019Z","avatar_url":"https://github.com/andrewharvey.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\nThis package contains a set of shell scripts for working with NASA SRTM DEM\ndata, gdaldem based stylesheets for creating shaded relief and/or hypsometric\ntinted maps, Mapnik stylesheets for making contours maps and a TileStache\nconfiguration for sandwiching or compositing the shaded relief and contour maps.\n\n![SRTM3 Hillshaded, Color Relief Contour\nMap](http://tianjara.net/hosted/srtm3-stylesheet-git-preview.png)\n\nThe aim of the project is to produce a free and open source repeatable workflow\nfor visualising worldwide elevation data.\n\nThis project should be useful if you want to,\n* automate the download of SRTM3 data\n* produce a void filled single large GeoTIFF DEM from SRTM3 HGT tiles\n* produce hill shaded, slope shaded, hypsometric and/or contour maps\n* have contours loaded into a PostgreSQL/PostGIS database for use in a GIS\n* have a simple general purpose elevation layer/map (default style included)\n\nAll of the above use cases are accommodated for in these scripts.\n\nThe SRTM data has been released at varying resolution. SRTM3 refers to the\nnear global 3 arc-second product and SRTM1 the higher resolution 1 arc-second\nproduct. SRTM1 was only released to the public in late 2014 and is not listed\non the public directory yet at dds.cr.usgs.gov/srtm. You can however download\nthe files by navigating the website at http://earthexplorer.usgs.gov/.\n\n# License\nWith the exception of stylesheets/configure.py which is 3-clause BSD\nlicensed, all files within this repository are licensed by the author,\nAndrew Harvey\u003candrew.harvey4@gmail.com\u003e as follows.\n\n    To the extent possible under law, the person who associated CC0\n    with this work has waived all copyright and related or neighboring\n    rights to this work.\n    http://creativecommons.org/publicdomain/zero/1.0/\n\nThe SRTM data which these scripts are designed to use is in the public\ndomain because it was solely created by NASA. NASA copyright policy\nstates that \"NASA material is not protected by copyright unless noted\".\n\n# Running through the scripts\n## Dependencies\nTo run through all the steps provided by these script you will need,\n\n    wget unzip xz-utils gdal-bin postgresql-client postgis carto tilestache libmapnik|libmapnik2 fonts-sil-gentium-basic python-gdal\n\n## Downloading SRTM3 data\n\n    ./scripts/01-download.sh SRTM3_Region...\n\nTo determine the SRTM3_Region see the [region map](http://dds.cr.usgs.gov/srtm/version2_1/Documentation/Continent_def.gif),\nin combination with the [actual directory names](http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/) for these regions.\n\nYou can list multiple regions as arguments or just one.\n\nThe coordinates refer to the bottom left corner of the tile, or expressed\ndifferently the tile is in the top right quadrant referred to by the coordinate.\n\n## Downloading SRTM1 data\nPresently you need to navigate and manually download scenes via  http://earthexplorer.usgs.gov/\n\n## Unzipping downloads\nTo unzip these downloads run,\n\n    ./scripts/02-unzip.sh\n\nIf you want to keep these files for later reference, you may wish to\nre-compress using xz to save space using,\n\n    ./scripts/03-rexz.sh\n\nWhich you can later uncompress again using,\n\n    ./scripts/03b-unxz.sh\n\n## Grunt work\nIf you have made it this far then all the data is prepared and ready for\nthe real grunt work. The are two bits of processing we do. Preparing the\nvector contours and preparing the raster DEM. To create the final\nsandwiched map you will need to perform both steps, if not then you can\njust perform one.\n\n### Raster DEM processing\n\n#### Creating a mosaic DEM\nTo avoid edge artefacts and to make the process simpler, we mosaic all\nthose 1 x 1 degree tiles into a single continent mosaic using,\n\n    ./scripts/04-merge.sh SRTM1|SRTM3 SRTM_Continent lon0 lon1 lat0 lat1\n\nThe last four parameters are the bounds we will use for the mosaic. You\ncan only use integer values as they are simply used to select which\nindividual .hgt tiles to glue together.\n\nAn additional processing step is also run as part of this script to fill the\nvoids in the data. However you need to apply this patch\nhttp://trac.osgeo.org/gdal/ticket/4464 to your gdal_fillnodata.py script for\nthis to work.\n\n#### Hill shading and color relief (hypsometric tints)\n\n    ./scripts/07-shaded-relief.sh SRTM1|SRTM3 SRTM_Continent\n\nKeep in mind that the hypsometric tint values are defined in\n`stylesheets/color-ramps/srtm-Continent-color-ramp.gdaldem.txt`. In the first\ncolumn you have the elevation value in meters. I've only created a color ramp\nspecifically suited for the highest point in Australia. I'm not sure of the\nbest approach for applying this on a global scale.\n\n### Vector contour processing\nYou will need a PostgreSQL database set up somewhere with the PostGIS\nextensions installed.\n\nThen make sure you set your [PG* environment variables](http://www.postgresql.org/docs/current/static/libpq-envars.html), for example,\n\n    export PGDATABASE=srtm\n\nthen run,\n\n    ./scripts/05-contour-tiles.sh SRTM1|SRTM3 lon0 lon1 lat0 lat1\n\nThis will convert the DEM into contours and load them into a PostgreSQL\ndatabase.\n\nAfter this you will need to run,\n\n    psql -f ./scripts/06-contour-level-pyramid.sql\n\nThis creates materialised tables of higher level contours (ie. 50m from\nthe base 10m ones) and some other plumbing work.\n\n# Previewing the Mapnik style\nIf you have made it this far then you should be ready to start rending\nsome maps!\n\nThere are two styles within the stylesheets directory. One for contours\nand one for the hill shaded color relief.\n\nThere is also a sample TileStache configuration for sandwiching these\ntogether into a single map layer.\n\nThe hill shaded color relief style should be ready to go.\n\nThe contour style needs to be configured with,\n\n    ./stylesheets/configure.py\n\nYou can pass it parameters --host, --port, --dbname, --user, --password.\n\nWhen you run it, it will copy the `contours.template.mml` into\n`contours.mml` and fill in the new file with your configuration.\n\nYou can then further run,\n\n    carto stylesheets/contours.mml \u003e contours.xml\n\nTo convert it into a Mapnik XML stylesheet.\n\nYou could preview these independently with TileLite's `litserv`, or you\ncould just run,\n\n    tilestache-server -c stylesheets/srtm3.tilestache.cfg\n\nAlternatively you can generate some samples/previews of both the independent\nlayers and the sandwiched layer using,\n\n    ./scripts/08-create-previews.sh\n\nBe aware that for this you will need\nhttps://gist.github.com/andrewharvey/1290744 in your $PATH and the ImageMagick\nprogram convert.\n\nThere is a [live preview of this sandwiched stylesheet](http://tianjara.net/map#srtm3/8/-34.003/151.125).\n\n# Cleaning up\nThere are some files you can remove to save some space.\n\n    # remove the original zipped hgt files we downloaded from USGS\n    rm -rf dds.cr.usgs.gov\n\n    # remove the unzipped hgt files (if you want you can keep a .tar.xz)\n    rm -rf SRTM3\n\n    # if you no longer need the single large DEM but are just using the layers/\n    rm -rf SRTM3*.tiff\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewharvey%2Fsrtm-stylesheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewharvey%2Fsrtm-stylesheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewharvey%2Fsrtm-stylesheets/lists"}