Coder Social home page Coder Social logo

srtm_to_stl's Introduction

SRTM_to_CSV.py converts a NASA SRTM3 (3 arcsec) hgt file into csv format
The first line of the csv file contains the width, height and maximum_height
Each line after that is in the format east,north,height

UK data is converted to OSGB coordinates using WGS84toOSGB36
Data for the rest of the World is converted to UTM

The csv 'tiles' can then be:
joined together with CSV_Join.py
trimmed with CSV_Trim.py
healed with CSV_Heal.py (interpolates any missing data points)
converted to stl format for 3D printing with CSV_to_STL.py
and then displayed in 3D with 3D_CSV.py or 3D_STL.py (optional)

To create a trimmed stl file of the UK Lake District:
Download N54W004.hgt and N54W003.hgt
Put SRTM_to_CSV.py, CSV_Join.py, CSV_Trim.py, CSV_to_STL.py in the same directory
From the command line:
python SRTM_to_CSV.py N54W004.hgt y
python SRTM_to_CSV.py N54W003.hgt y
python CSV_Join.py N54W004.csv N54W003.csv
python CSV_Trim.py N54W004_join.csv 298000 363000 477000 542000
python CSV_Heal.py N54W004_join_trim.csv
python CSV_to_STL.py N54W004_join_trim_heal.csv 5.0 130.0 0.5 1.0

slic3r or MeshLab will display the STL files, but if you want to view one
using Python and MatPlotLib you can:
python 3D_CSV.py N54W004_join_trim_heal.csv 5.0 y
python 3D_STL.py N54W004_join_trim_heal.stl

Download the SRTM3 (3 arc-second) hgt files from:
http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/
The continent map is available at:
http://dds.cr.usgs.gov/srtm/version2_1/Documentation/Continent_def.gif

SRTMGL1 (1 arc-second) data can be downloaded from:
http://earthexplorer.usgs.gov/
(select the data set called
"NASA LPDAAC Collections \ NASA SRTM (SRTM 3) Collections \ NASA SRTM3 SRTMGL1")
and then converted to 3 arc-second using SRTM_resample:
python SRTM_resample.py N54W004.hgt
This is advantageous as the 1 arc-second data has been cleaned up but
avoids you having nine times as much data to process. Check out SRTM_to_STL_1
if you want to work with the 1 arc-second data at full resolution

The hgt filename refers to the lower left pixel or sample in the data
Sample spacing is 3 arc-seconds for SRTM3 data
Data is two byte signed integers (big endian)
First row in the file is the ***northernmost*** one

utm has been gratefully plagiarised from https://pypi.python.org/pypi/utm
and then modified to allow the UTM zone to be forced. This is essential if
the hgt data crosses or ends on a UTM zone boundary. See http://www.dmap.co.uk/utmworld.htm

WGS84toOSGB36 is gratefully plagiarised from:
http://hannahfry.co.uk/2012/02/01/converting-latitude-and-longitude-to-british-national-grid/

If you have enjoyed this code, please make a small donation to Keswick Mountain Rescue Team:
http://www.keswickmrt.org.uk/support_us.htm
http://www.keswickmrt.org.uk/

srtm_to_stl's People

Contributors

paulzc avatar

Watchers

James Cloos 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.