I need to visualize some geodata in a world map. I have learnt the Flowing Data's great circle mapping tutorial and the result seems odd. It is like the following:
And apparently I need to avoid these crossing-picture lines. But how can I do that? The code to plot the map is this:
map("world", col="#f2f2f2", fill=TRUE, bg="white",lwd=0.05)
for (j in 1:length(location$lon)) {
inter <- gcIntermediate(c(lon_nj, lat_nj), c(location$lon[j], location$lat[j]), n=100, addStartEnd=TRUE)
lines(inter, col="black", lwd=0.8)
}
And I have tried the code provided by gpe Automating great-circle map production in R
map("world", col="#f2f2f2", fill=TRUE, bg="white",lwd=0.05)
for (j in 1:length(location$lon)) {
inter <- clean.Inter(c(lon_nj, lat_nj), c(location$lon[j], location$lat[j]),n=100, addStartEnd=TRUE)
lines(inter, col="black", lwd=0.8)
}
And the result is like this:
And I just want to use the shortest distance to get to the required place.
And the answers from web like using another function like greatCircle() has also failed to realize my goal.
So is there anyone have some idea how to realize this purpose?
Thank you very much!!