【发布时间】:2023-03-23 22:54:02
【问题描述】:
我有家庭收入的经纬度数据,我想将这些点与家庭收入叠加在建筑物的基本地图上,就像您在 Google 地图中看到的那样(只是建筑物的轮廓,而不是卫星图像)。我尝试查看 R mapview 和 osmdata 包,但我找不到如何制作基本地图/建筑物的基本地图。任何线索都会有所帮助!谢谢!
#create data
lat <- c(33.97463, 33.97458, 33.97460, 33.97520, 33.97403, 33.97607)
long <- c(-117.9180, -117.9183 , -117.9185, -117.9186 , -117.9184, -117.9184)
income <- c(15000, 30000, 50000, 20000, 30000, 100000)
data <- as.data.frame(cbind(lat, long, income))
#plot household income as lat/long points
library(ggplot2)
ggplot() +
geom_point(data = data, aes(x = long, y = lat,
colour = income),size =2)+
scale_color_stepsn(n.breaks = 5, colours = terrain.colors(5))+
theme_bw()
#add basemap of buildings like Google Maps
【问题讨论】: