I need to convert a JSON response from Mapquest elevation API into a GeoJSON layer in my Leaflet map.
var ele = $.getJSON('http://open.mapquestapi.com/elevation/v1/profile?key=<API_KEY>&shapeFormat=raw&latLngCollection='+profile);
this is a sample of JSON reponse:
{
"shapePoints":[
39.74012,
-104.9849,
39.7995,
-105.7237,
39.6404,
-106.3736
],
"elevationProfile":[
{
"distance":0,
"height":1616
},
{
"distance":63.5583,
"height":3910
},
{
"distance":121.9561,
"height":2501
}
],
"info":{
"copyright":{
"text":"© 2018 MapQuest, Inc.",
"imageUrl":"http://api.mqcdn.com/res/mqlogo.gif",
"imageAltText":"© 2018 MapQuest, Inc."
},
"statuscode":0,
"messages":[
]
}
}