I have a set of x,y coordinates, each of which I'm trying to get an elevation reading for.
The elevation data source, however, is not a regular grid, but consists of a shapefile containing scattered, irregular points, as this QGIS screenshot shows:
I'm used to using grid-based files such as SRTM or ASTER, which have a reading on a regular grid, and using a TIF reader to extract the locations. However, the above data is obviously quite different.
What is the best way to deal with this? I'm not a GIS expert - much more a coder.
Approaches that occur to me are:
Interpolate the points into a regular grid. Would
gdal_grid
as noted at https://gis.stackexchange.com/a/24610/58752 be workable?Convert the points to triangles somehow and then interpolate the x,y from the triangle that it is in.
Crucially, I want to do this using command-line processing rather than point-and-click in GIS if possible, so that it is easily reproducible from the original data download.
Presumably the above screenshot indicates that the elevation field is called 'ALTURA'.
Any pointers would be useful.
(I'm aware that SRTM covers the area that this second data source does, but the data is a ground-based survey and avoids the problems of incorrect readings in SRTM due to building heights and trees, which are proving problematic.)
PS Is there a simple way to get the points out of the shapefile as a CSV? I can't seem to get this using either ogr2ogr or gdallocationinfo.
ogr2ogr -f CSV pts.csv -lco GEOMETRY=AS_XY pts.shp
gets you point features out of a shapefile as a CSV. As to the main question, some kind of spatial interpolation (nearest neighbour, IDW, or Kriging) is needed to interpolate altitude values at non-measured locations...