topography

How do I access .HGT SRTM files in C++?

限于喜欢 提交于 2019-12-30 10:54:07
问题 Here is a similar question on the topic with a good description of the file: how to read NASA .hgt binary files I am fairly new to programming in general and my efforts thus far have been very limited. My ultimate goal is to access the elevation data and store it in a 2D array for easy access. I have been trying to read the file 2 bytes at a time, as has been suggested, but I don't know what to do next. Here is what I've got so far: #include <iostream> #include <fstream> using namespace std;

Python equivalent for Matlab's Demcmap (elevation +/- appropriate colormap)

北城余情 提交于 2019-12-30 05:11:07
问题 I am looking for a way to get an elevation appropriate colormap for matplotlib . the cmap ' terrain ' looks great but the colorscaling isn't based around zero (i.e. if the scale is 0->5000m, the 0->1000m range may be shades of blue, which you would assume to be for below sea-level) for example: The Matlab function equivalent is: demcmap What is the best way to get matplotlib to shift a terrain colormap's greens/browns and blues around the zero elevation mark? 回答1: Unfortunaly, matplotlib does

How do I access .HGT SRTM files in C++?

前提是你 提交于 2019-12-01 07:55:00
Here is a similar question on the topic with a good description of the file: how to read NASA .hgt binary files I am fairly new to programming in general and my efforts thus far have been very limited. My ultimate goal is to access the elevation data and store it in a 2D array for easy access. I have been trying to read the file 2 bytes at a time, as has been suggested, but I don't know what to do next. Here is what I've got so far: #include <iostream> #include <fstream> using namespace std; int main () { ifstream::pos_type size; char * memblock; ifstream file ("N34W119.hgt", ios::in|ios: