GithubHelp home page GithubHelp logo

imclab / srtm-heightmap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bmount/srtm-heightmap

0.0 1.0 0.0 11.86 MB

encode radar topography hgt data in pngs

Home Page: http://bmount.github.com/srtm-heightmap/

JavaScript 17.22% Python 75.77% Shell 7.01%

srtm-heightmap's Introduction

Terrain data for web maps, games, visualizations

death valley example

This is a little utility for generating heightmaps from Shuttle Radar Topography Mission records.

They may be somewhat visually meaningful on their own, but mostly they're a convenient way to pack three dimensional data into a format browsers understand for applications like this.

1px = 1/3600 degree longitude or latitude, about 30m, color value is height, encoded as described below

install

pip install numpy PIL, run as ./hgt2png or add to PATH

Examples

Download and create PNG of the SRTM data for N 38 W 97 to N 39 W 96, in 1 big tile containing the point [lon,lat] provided:

hgt2png --download 96.432 38.123

Download and create a PNG of the data within a bounding box:

hgt2png --bbox -96.8 38.2 -96.6 38.5

Use, resize or reuse a file you already downloaded:

hgt2png --file N38W097.hgt --bbox -96.8 38.2 -96.6 38.5

Render a square area only:

hgt2png --square --file N38W097.hgt --bbox -96.8 38.2 -96.6 38.5

FORMAT:

Red channel: floor ( height / 256 ) (measurement in meters)

Green channel: height mod 256

Blue channel: centimeters offset from r*256 + b (not used in SRTM, sort of left here in case some client stuff ever gets written that could use more precision.)

Alpha channel: Just a switch indicating negative or positive. 255 or any other value means positive, 21 (0x15 the ASCII code for negative acknowledge character (tee hee)) means negative.

Elevation equals ( RED * 256 + GREEN + BLUE/100 ) * (ALPHA == 21) * (-1) Unprojected lon lat coordinates can be calculated from the images + file names.

If you have GDAL installed

you can call it with --exportable and you'll get a georeferenced tif that you can use for example in TileMill or QGIS.

License: MIT

srtm-heightmap's People

Contributors

bmount avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.