使用R的传单包添加弯曲的飞行路径 [英] Adding Curved Flight path using R's Leaflet Package

查看:65
本文介绍了使用R的传单包添加弯曲的飞行路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我可以使用以下代码在国家之间画一条直线:

Currently I'm able to draw a straight line between countries using the following code:

library(leaflet) 
leaflet() %>% addTiles() %>% addPolylines(lat=c(38.8833, 35.00), lng=c(-77.0167, 103.00))

我试图产生的是一条更真实的飞行路径,该直线实际上是弯曲的.与此类似:

What I'm trying to produce is a more realistic flight path, where the straight line is actually curved. Similar to this:

出于这个问题,我想在Leaflet包中定制答案.任何帮助将不胜感激.

For the sake of this question, I'd like to tailor the answer within the Leaflet package. Any help would be much appreciated.

推荐答案

紧接着mrub,只需将您从gcIntermediate获得的对象传递给传单.像这样的东西:

following up on mrub, just pass the object you get from gcIntermediate to leaflet. something like this:

library(leaflet)
library(geosphere)
gcIntermediate(c(5,52), c(-120,37),
               n=100, 
               addStartEnd=TRUE,
               sp=TRUE) %>% 
leaflet() %>% 
addTiles() %>% 
addPolylines()

这篇关于使用R的传单包添加弯曲的飞行路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆