admin管理员组文章数量:1023827
I am working with leafletjs and added MAP. I want to get elevation from current latitude and longitude or current place only, but it will return whole path elevation.
var el = L.control.elevation();
el.addTo(map);
var gjl = L.geoJson(geojson,{
onEachFeature: el.addData.bind(el)
}).addTo(map);
map.addLayer(service).fitBounds(bounds);
How can I find the elevation with either mapbox or leafletjs.
I am working with leafletjs. and added MAP. I want to get elevation from current latitude and longitude or current place only, but it will return whole path elevation.
var el = L.control.elevation();
el.addTo(map);
var gjl = L.geoJson(geojson,{
onEachFeature: el.addData.bind(el)
}).addTo(map);
map.addLayer(service).fitBounds(bounds);
How can I find the elevation with either mapbox or leafletjs.
Share Improve this question edited Dec 6, 2017 at 0:45 Steve Bennett 127k45 gold badges186 silver badges244 bronze badges asked Dec 5, 2017 at 8:52 VedVed 2,7012 gold badges24 silver badges30 bronze badges 3- What do you mean with current place only and current latitude and longitude? Looking at your code it seems that you are adding elevation to every feature element – kiks73 Commented Dec 5, 2017 at 8:57
- elevation of current place only, above code return elevation of whole json data. – Ved Commented Dec 5, 2017 at 8:59
- I want like this developers.google./maps/documentation/javascript/examples/… – Ved Commented Dec 5, 2017 at 9:01
2 Answers
Reset to default 4Leaflet is a map display library, not a data API, not a elevation raster query library.
For this, you will have to rely in some kind of elevation dataset (which one is "better" depends on your definition of "better").
For example, see Getting Altitude(height from sea level) of my location in iphone SDK
Whether to use a service like that or whether you should have your own elevation dataset is up to you. In any case, Leaflet does not provide a favourite elevation query service by default (contrary to what Google Maps does, as it relies on Google's elevation datasets).
Extending on @IvanSanchez's answer, you'll need to integrate a service to grab the elevation from your point. One such library which will do this with Mapbox is https://github./mcwhittemore/mapbox-elevation
I am working with leafletjs and added MAP. I want to get elevation from current latitude and longitude or current place only, but it will return whole path elevation.
var el = L.control.elevation();
el.addTo(map);
var gjl = L.geoJson(geojson,{
onEachFeature: el.addData.bind(el)
}).addTo(map);
map.addLayer(service).fitBounds(bounds);
How can I find the elevation with either mapbox or leafletjs.
I am working with leafletjs. and added MAP. I want to get elevation from current latitude and longitude or current place only, but it will return whole path elevation.
var el = L.control.elevation();
el.addTo(map);
var gjl = L.geoJson(geojson,{
onEachFeature: el.addData.bind(el)
}).addTo(map);
map.addLayer(service).fitBounds(bounds);
How can I find the elevation with either mapbox or leafletjs.
Share Improve this question edited Dec 6, 2017 at 0:45 Steve Bennett 127k45 gold badges186 silver badges244 bronze badges asked Dec 5, 2017 at 8:52 VedVed 2,7012 gold badges24 silver badges30 bronze badges 3- What do you mean with current place only and current latitude and longitude? Looking at your code it seems that you are adding elevation to every feature element – kiks73 Commented Dec 5, 2017 at 8:57
- elevation of current place only, above code return elevation of whole json data. – Ved Commented Dec 5, 2017 at 8:59
- I want like this developers.google./maps/documentation/javascript/examples/… – Ved Commented Dec 5, 2017 at 9:01
2 Answers
Reset to default 4Leaflet is a map display library, not a data API, not a elevation raster query library.
For this, you will have to rely in some kind of elevation dataset (which one is "better" depends on your definition of "better").
For example, see Getting Altitude(height from sea level) of my location in iphone SDK
Whether to use a service like that or whether you should have your own elevation dataset is up to you. In any case, Leaflet does not provide a favourite elevation query service by default (contrary to what Google Maps does, as it relies on Google's elevation datasets).
Extending on @IvanSanchez's answer, you'll need to integrate a service to grab the elevation from your point. One such library which will do this with Mapbox is https://github./mcwhittemore/mapbox-elevation
本文标签:
版权声明:本文标题:leaflet - How to get elevation from current latitude and longitude using leafltejs OR mapbox javascript API - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745566928a2156506.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论