I am building an application in leaflet, and I need to be able to access slope and aspect as a function of latitude and longitude. Currently I am able to get elevation data from the mapbox elevation dataset here, which can be processed pretty simply to get elevation as a function of latitude and longitude.
Does anyone know of a similar dataset, accesible in leaflet, that gives slope and aspect?
I know that ArcGIS online has a terrain dataset which contains these things. There is also a leaflet esri plugin that allows you to add the terrain layer in with L.esri.basemapLayer('Terrain')
. But I don't see a way to actually extract data from that, just to view it within leaflet.
There is this article which praises leaflet's creator for his ability to calculate aspect and slope in realtime as the user pans or zooms, based on the mapbox elevation dataset I mentioned above. But frankly I don't understand the code that he's quoting, and this seems both inaccurate at low zoom levels, and computationally expensive for high resolution maps. I thought of potentially creating my own function which takes a point, gets 6 or 8 points around it, get the elevation of those points, and then calculates slope and aspect from that. But that seems inefficient and computationally expensive, especially when I'm going to need to get slope and aspect for hundreds of points many times per second.
I have been casually searching around for months for how to get slope and aspect data within leaflet. If I have to learn a whole new framework to import into leaflet, I'm open to that. I'm just not sure where to start. Forgive me if this question is in the wrong place or has been answered elsewhere.
raster2dem
function there.