I have a set of latitude, longitude, and elevation pairs (roughly a grid of such values, though it is not uniform), and I'd like to be able to plot an elevation map and perhaps also a shaded relief image for this data. And I'd like to do this using python.
While I've seen some interesting examples of people making such maps online, they always start by reading in some data file which is in some format which I am not familiar with (perhaps they have a measurement device which simply outputs this format).
I'm curious how I might go about doing such a thing from the simple latitude, longitude, and elevation pairs.
I currently only need to plot small geographic regions (10 square miles, for example).
Best Answer
1) you read the data (x,y,z) from text files, shapefiles, etc., with Python only or with different Python modules (pandas, csv, Python - Excel, Fiona, Pyshp, osgeo:OGR or ...)
2) you can plot the points
in 2D: with matplotlib
!!
in 3D: with visvis or matplotlib for example
3) you can compute contour lines (and other things...)
4) you interpolate the data with various methods/algorithms to create a grid/surface (with matplotlib, NumPy, SciPy, osgeo:GDAL, Mayavi and others)
5) you can save the resulting file with osgeo:GDAL, create Shaded Relief Map and ... (look at Python GDAL/OGR Cookbook, Shaded Relief Map in Python, or Shaded relief images using GDAL python as John Barça says, for example)
Plotted with matplotlib:
New:
Example of processing points from shapefile (z as attribute):
Generate a regular grid to interpolate the data.
Interpolate the values of z for all points in the rectangular grid with matplotlib griddata
Plot in 3D with matplotlib
Plot in 3D with visvis
Save to GeoTiff file