I have rasters from the National Elevation Dataset loaded into a Postgres database and am using the built-in function ST_Slope to calculate the slope. However these contain many holes where there is valid elevation data.

Here is my query:

SELECT (ST_DumpValues(ST_Slope(raster), ARRAY[1], False)).valarray as slope
FROM nat_elev_data

I suspect that I need to pass additional parameters but am not sure what.

  • ST_Slope(raster, band, pixeltype) is the more common format. Perhaps you could post some data for the raster? Jul 1, 2015 at 17:27
  • The NED data is publicly available. But to try to simplify things suppose I just had a single band raster with elevation in meters, could I just use ST_Slope(raster) or would I also need to specify ST_Slope(raster, 1, '32BF') to get valid slopes? Jul 1, 2015 at 17:35
  • There are default values for most parameters. No substitute for just running it to see. Jul 2, 2015 at 5:23
  • Perhaps I am misunderstanding the function but why does it return so many holes? Jul 2, 2015 at 13:12
  • I don't know without knowing what area you are looking at. Is there any way you can put a sample of your area as a gist on github or similar. Also, what is the value of ARRAY[1] above? Jul 2, 2015 at 13:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.