Comments (3)
Using python some DEM info has been loaded, ilha das Flores and ilha do Corvo from Azores:
import tifffile as tiff
import matplotlib.pyplot as plt
import rasterio
tfile = tiff.imread('eu_dem_v11_E00N20.TIF')
tfile.shape
tiff.imshow(tfile)
plt.show()
Source: https://gis.stackexchange.com/questions/337343/altitude-extraction-from-a-dem-tiff-file-using-python
from trackeditor.
A deeper analysis of this can drive to the creation of an API to get elevation from given coordinates.
from trackeditor.
This small code allows to open 'one band' of the tiff file. However, when using a larger file a MemoryError is raised:
numpy.core._exceptions.MemoryError: Unable to allocate 5.96 GiB for an array with shape (1, 40000, 40000) and data type float32
import rasterio
# Which band are you interested.
# 1 if there is only one band
band_of_interest = 1
# Row and Columns of the raster you want to know
# the value
row_of_interest = 30
column_of_interest = 50
# open the raster and close it automatically
# See https://stackoverflow.com/questions/1369526
with rasterio.open('eu_dem_v11/eu_dem_v11_E00N20.TIF') as dataset:
band = dataset.read(band_of_interest)
print(band)
value_of_interest = band[row_of_interest][column_of_interest]
print(value_of_interest)
print(len(band))
l_band = []
for b in band:
l_band.append(len(b))
print(min(l_band), max(l_band))
Fortunately, there is some information on how the files are constructed:
Additional information
The EU-DEM is a 3D raster dataset with elevations captured at 1 arc second postings (2.78E-4 degrees) or about every 30 metre.
All three datasets are made available as tiles (5x5° or 1000x1000km) and as single files:
- EU-DEM in ETRS89 geographic (EPSG code 4258)
- EU-DEM in ETRS89-LAEA (EPSG code 3035)
- Colour shaded relief image over Europe in ETRS89-LAEA (EPSG code 3035)
The datasets are encoded as GeoTIFF with LZW compression (tiles) or DEFLATE compression (European mosaics as single files).
https://www.eea.europa.eu/data-and-maps/data/eu-dem
Therefore, the firsts steps to create an API would be:
- Read small tif file, such as eu_dem_v11_E10N20, and get altitude given coordinates.
- Read tif files by reduced chunks.
- Load data to a SQL database.
from trackeditor.
Related Issues (20)
- Add badges to README HOT 1
- Debug github actions HOT 1
- Use decorator to catch non expected exceptions HOT 1
- Insert unit tests: utils HOT 1
- Improve unit tests for: gpx, iosm and db_handler HOT 1
- Split & Remove action is failing HOT 1
- Remove md5 check in add_gpx method
- Update last segment index in divide_segment
- Misterious needed exception
- Extra segment when splitting after segment removal
- Selected segments have more displayed points
- Usage example with gif HOT 1
- Segment selection is not working after loading session
- Exception is raised when loading gpx after everything is removed
- Create thread with 'loading' window HOT 3
- Create a new window for split segment functionality HOT 1
- Force version in requirements.txt
- Create binary executables with pyinstaller HOT 4
- Try lighter linux distribution for docker HOT 1
- Create icon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trackeditor.