Skip to content
Prev 26803 / 29559 Next

Adding great circle routes as polylines in Leaflet

Ben and Kent, thank you so much for your replies. Both work!

@Ben next time will make sure the code is more ?calorie-free? :)

@Kent Johnson <kent3737 at gmail.com> I modified the weight for the lines by
using a scaling factor.

myScale <- function(x){(x-min(x))/(max(x)-min(x))}

ByRoute$AvgTCE <- myScale(ByRoute$AvgTCE)*5 + 1

@Kent Johnson <kent3737 at gmail.com> yes, this is shipping data and you are
right, great circle routes are not the best visualization. The problem I am
facing is that I have oil trade happening over a period of time from
various ports that I need to visualize. Over the selected period of time,
there are hundreds of voyages being undertaken by ships. Plotting them all
as gc routes looks ugly. My approach has been to classify these ports into
regions, which I drew using mapedit and saved them as SF polygons. I then
calculated their centroids and those are the coordinates in the ByRoute
dataframe. Would appreciate your comments on any other visualization which
you think might be appropriate.

Regards
Dhiraj Khanna
Mob:09873263331
On Mon, Sep 3, 2018 at 10:22 PM Kent Johnson <kent3737 at gmail.com> wrote: