Created
August 25, 2015 08:07
-
-
Save kazutan/3adf209d09abd3a63d75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 台風情報 | |
library("dplyr") | |
library("rvest") | |
library("stringr") | |
library("leaflet") | |
trg <- html("http://www.jma.go.jp/jp/typh/") %>% html_table | |
tbl1 <- trg[[4]] # テーブルは4番目以降が台風に関するもので今回は台風15号と16号があるので4を指定 | |
res <- data.frame( | |
timing = tbl1$X1 %>% str_subset("[0-9][0-9]日[0-9][0-9]時"), | |
lat = tbl1$X2 %>% | |
str_subset("北緯") %>% | |
str_extract("[0-9][0-9]\\.[0-9]度") %>% | |
str_replace("度","") %>% | |
as.numeric, | |
lon = tbl1$X2 %>% | |
str_subset("東経") %>% | |
str_extract("[0-9][0-9][0-9]\\.[0-9]度") %>% | |
str_replace("度","") %>% | |
as.numeric | |
) | |
m <- leaflet::leaflet(res) %>% | |
addTiles() %>% | |
setView(lng = 139.0000, lat = 35.0000, zoom = 4) %>% | |
addPolylines(~lon,~lat,color="red") %>% | |
addCircleMarkers( | |
radius = 4, | |
color = "red", fillOpacity = 0.8, | |
stroke = FALSE, popup = ~timing | |
) | |
m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
予報円に改造してみた。
久々にleafletみたらめっちゃ進化してた