Plot coordinates on map

前端 未结 4 1461
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 12:17

I am trying to plot my coordinates using R. I have tried already to follow different post (R: Plot grouped coordinates on world map ; Plotting coordinates of multiple points

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 12:45

    Another option is using the leaflet package (as suggested here). Unlike Google Maps it does not require any API key.

    install.packages(c("leaflet", "sp"))
    library(sp)
    library(leaflet)
    df <- data.frame(longitude = runif(10, -97.365268, -97.356546), 
                     latitude = runif(10, 32.706071, 32.712210))
    
    coordinates(df) <- ~longitude+latitude
    leaflet(df) %>% addMarkers() %>% addTiles()
    

提交回复
热议问题