I'm trying to learn how to create elevation contour lines on a map in python following some of the ideas in https://medium.com/analytics-vidhya/creating-contour-lines-on-folium-map-with-python-b7994e67924b .
Using https://pypi.org/project/dem-stitcher/ I have the following code to download DEM data within a bounding box:
bounds = bounding_box_naive(coordinates)
print(bounds)
flattened_bounds = [coord for point in bounds for coord in point]
print(flattened_bounds)
X, p = stitch_dem(flattened_bounds,
dem_name=dem_name,
dst_ellipsoidal_height=dst_ellipsoidal_height,
dst_area_or_point=dst_area_or_point)
I then wrote it to a file with:
fig, ax = plt.subplots(figsize=(8, 8))
ax = plot.show(X, transform=p['transform'], ax=ax)
ax.set_xlabel('Longitude', size=15)
ax.set_ylabel('Latitude', size=15)
followed by:
height_type = 'ellipsoidal' if dst_ellipsoidal_height else 'geoid'
with rasterio.open(out_directory / f'{dem_name}_{height_type}_{dst_area_or_point}.tif', 'w', **p) as ds:
ds.write(X, 1)
ds.update_tags(AREA_OR_POINT=dst_area_or_point)
I eventually end up with data in a dataframe that looks like:
longitude latitude elevation
1 -88.432778 31.661389 72.399994
2 -88.432500 31.661389 74.471750
3 -88.432222 31.661389 76.551100
4 -88.431944 31.661389 76.705060
5 -88.431667 31.661389 77.992940
.. ... ... ...
212 -88.431944 31.654167 79.082660
213 -88.431667 31.654167 79.882225
214 -88.431389 31.654167 78.264725
215 -88.431111 31.654167 79.834656
216 -88.430833 31.654167 79.141390
[216 rows x 3 columns]
I can understand the latitude and longitude, but what unit is the elevation in?
