使用卫星地图在R中创建气泡图

时间:2014-05-02 11:50:11

标签: r map plot satellite

我已使用以下代码创建了一个气泡图:

library(ggplot2)

library(sp)

library(raster)

library(maps)

library(mapdata)

library(maptools)

library(gstat)

library(ggmap)

xy <- se_pp[,c("longitude_s", "latitude_s")]

nl <- getData('GADM', country="Netherlands", level=2) #raster data, format SpatialPolygonsDataFrame

# coercing the polygon outlines to a SpatialLines object

spl <- list("sp.lines", as(nl, "SpatialLines"))

SPDF <- SpatialPointsDataFrame(coords=xy, data=se_pp)

projection(SPDF)<- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"

coordinates(SPDF)[1:5,] #retrieves spatial coordinates form the dataframe

bubble(SPDF, "Quantity", sp.layout=spl, main="Plaice Quantity (#/km2), end summer (Sand Engine)")

现在我得到一张包含气泡图的荷兰海岸地图(通过getData)。 不幸的是,这是一张非常简单的地图 我希望有一个相同区域的卫星地图,显示更多细节,以显示我的气泡图。 有谁知道这是否可能? 感谢。

1 个答案:

答案 0 :(得分:1)

我不确定你是否仍然检查过。但是,我为你留下了一种方法。您可以使用缩放值来识别最适合您的缩放比例。 ggmap的CRAN手册为您提供了更多示例。请看看。

map <- get_map(location = 'netherlands', zoom = 7,
               source = 'google',
               maptype = 'satellite')

ggmap(map)