使用R在OpenStreetMap上绘制纬度/经度点

San*_*sen 0 gis r openstreetmap ggplot2

我无法将头部包裹在投影上。我对北欧地区的看法最终指向中部非洲。

我的代码如下。

#Loading packages

library(OpenStreetMap)
library(rgdal)
library(ggplot2)

#defining world map
map <- openmap(c(70,-179), c(-70,179))
plot(map)

#Finding my work place in Northern Europe (Ørbækvej 100, Odense, Denmark from here: https://www.latlong.net/convert-address-to-lat-long.html)
subscr<-data.frame(lat=c(55.381640),
                   lon=c(10.433600))

#I am not sure what this does, but found on the web for a map in Germany: (https://gis.stackexchange.com/questions/209166/plotting-bubbles-on-top-of-openstreetmap-in-r) 
coordinates(subscr)<-~lat+lon
proj4string(subscr)<-CRS("+init=epsg:4326")
points(spTransform(subscr,osm()))
#as can be seen using this method the dot turns up in Eastern Africa


symbols(y = subscr$lon, x = subscr$lat, circles = 1, add = TRUE,
        inches = 0.0001, bg = "darkgreen")
#as can be seen using the method the dot turns up in Western/Mid Africa
Run Code Online (Sandbox Code Playgroud)

谁能解释甚至帮助我将这个点放在丹麦,北欧?

Wim*_*pel 5

我不知道您想要哪种地图,但是用于绘制纬度点leaflet是我的默认选择。

library( leaflet )
library( magrittr )

subscr<-data.frame(lat=c(55.381640),
                   lon=c(10.433600))

leaflet() %>% addTiles() %>% 
  addCircleMarkers(data = subscr,
                   lat = ~lat, lng = ~lon,
                   color = "blue")
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明