https://www.nrlmry.navy.mil/tcdat/tc19/ATL/05L.DORIAN/kml/2019_ATL_05L.main.kml
# after loading into Google Earth Pro save the "Dorian Track Line" component as kml.
# ("DorianTrackLine.kml")
# Data listed far below:
library(data.table)
library(rgdal)
# library(sp) # if necessary
# This foo will probably work for any NRL track line.
# I cannot locate where I found the original top function now.
allKmlLayers = function(x){
lyr = ogrListLayers(x)
mykml = listmy()
for (i in 1:length(lyr)) {
mykml[i] = readOGR(x,lyr[i])
}
names(mykml) = lyr
return(mykml)
}
allKmlLayers = function(x){
lyr = ogrListLayers(x)
mykml = list()
for (i in 1:length(lyr)) {
mykml[i] = readOGR(x,lyr[i])
}
names(mykml) = lyr
return(mykml)
}
x = "DorianTrackLine.kml"
mykml = allKmlLayers(x)
dev.new();
setnames(Map(as.data.table,
(rbind(Reduce(as.matrix,coordinates((mykml$Layer))))))[[1]],
c("long","lat"))[][,plot(lat,long,xlim =c(0,60),ylim=c(-30,-90))]
abline(v=30)
abline(h=-60)
setnames(Map(as.data.table,(rbind(Reduce(as.matrix,coordinates((mykml$Layer))))))[[1]],c("long","lat"))[]
# output
cat('
long lat
1: -55.5 51.6
2: -58.5 50.6
3: -60.4 49.4
4: -61.9 47.6
5: -62.9 45.2
6: -64.6 42.8
7: -66.9 40.9
8: -69.1 38.8
9: -71.2 37.5
10: -73.7 36.3
11: -75.7 35.1
12: -76.9 34.1
13: -77.9 33.4
14: -78.9 32.7
15: -79.2 32.1
16: -79.6 31.4
17: -79.7 31.0
18: -79.7 30.2
19: -79.6 29.5
20: -79.2 28.8
21: -78.8 28.1
22: -78.7 27.5
23: -78.4 27.1
24: -78.4 26.9
25: -78.4 26.8
26: -78.4 26.8
27: -78.2 26.7
28: -78.1 26.6
29: -77.7 26.6
30: -77.1 26.5
31: -76.5 26.5
32: -75.6 26.4
33: -74.7 26.2
34: -74.0 26.1
35: -73.0 25.9
36: -72.1 25.7
37: -71.0 25.3
38: -70.3 24.8
39: -69.4 24.2
40: -68.8 23.5
41: -68.0 22.8
42: -67.4 22.1
43: -66.9 21.0
44: -66.4 20.0
45: -65.7 19.2
46: -65.1 18.3
47: -64.1 17.1
48: -63.5 16.4
49: -62.7 15.8
50: -62.0 15.0
51: -61.3 14.0
52: -60.2 13.3
53: -59.2 13.0
54: -58.3 12.5
55: -57.1 12.1
56: -55.8 11.8
57: -54.7 11.6
58: -53.5 11.4
59: -52.3 11.1
60: -51.0 10.9
61: -49.7 10.8
62: -48.6 10.6
63: -47.4 10.3
long lat
')
No comments:
Post a Comment