【发布时间】:2018-10-12 09:47:34
【问题描述】:
我很难把头绕在投影上。我在北欧的一个地方的积分最终在中非。
我的代码如下。
#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
谁能解释甚至帮助我把点放在丹麦、北欧?
【问题讨论】:
-
关于您的代码中的“我不确定这是做什么的”:地图具有一定的projection。如果您配置了错误的投影,您的坐标最终会出现在错误的位置。
标签: r ggplot2 gis openstreetmap