Problem: I have a bunch of raster data (DTED) and I want to use this to make elevation queries using PostGIS (if it makes sense). E.g. I want to ask the question "what is the elevation at (lat1,lon1), (lat2, lon2)?" and the database would return the interpolated elevations based on the nearest neighbors where I have data.
Idea 1: Should I load the raster data into the data base in its raw form and make queries on that? Immediate downside sounds like the rasters are pretty big and maybe querying would be slower?
Idea 2: should I preprocess the raster data and load a bunch of points into the database (i.e. the database would have columns latitude, longitude, and altitude for all the measurements in the DTED data).
An example is show below.The intersection of the grid represents points that I have, the red stars represent points that I am querying for. So ideally, I would get a bilinear interpolation (or some other method) between my nearest neighbors. In the comments below, it was mentioned that the function http://postgis.net/docs/manual-dev/RT_ST_InvDistWeight4ma.html would help with this calculation. However, it is not clear to me how to use this function to get the answer I am looking for.