Arquisoft / viade_en3b

Viade en3b
0 stars 3 forks source link

Get elevation for points of a route created by form #86

Open PabloCanalSuarez opened 4 years ago

PabloCanalSuarez commented 4 years ago

When a user creates a route through the app's form, the trackpoints selected in the Leaflet map doesn't have any kind of elevation data. To obtain that, in case we need it, we will probably have to use an API.

I've done some research, and I found mainly two APIs that work to suffice our need of elevation data:

The MapQuest one will give us the opportunity to obtain an elevation chart, which will be useful in the future. I haven't studied a lot of the Google Maps one, but this one won't be free.

PabloCanalSuarez commented 4 years ago

Also, the MapQuest one gives us up to 15.000 free requests each month, so this is a good option.

PabloCanalSuarez commented 4 years ago

All this data was obtained from the National Geographic Institute (IGN) of Spain and its manual.

ElenaRodriguezRio commented 4 years ago

Leaflet has some plugins to represent elevation:

I think they would be an alternative worth exploring even though they don't have components for react

PabloCanalSuarez commented 4 years ago

Those proposals doesn't work in our case. As this post in StackOverflow says, Leaflet is a map display library, not a data API, which means we cannot obtain this kind of elevation data from the markers in the map itself.

As some user posted in that forum, one solution is using the library MapBox, which would give us the elevation of any point by simply providing the latitude and longitude of that point. One example of use would be this one:

var MapboxElevation = require('mapbox-elevation');
var getElevation('YOUR-MAPBOX-TOKEN');

getElevation([86.925313, 27.988730], function(err, elevation) {
  console.log('elevation at the summit of everest', elevation);
});
ElenaRodriguezRio commented 4 years ago

This issue is part of #99