Overture Maps
收藏overtureR 数据集概述
安装
r install.packages("overtureR")
devtools::install_github("arthurgailes/overtureR")
关键特性
- 直接在R中查询全球Overture Maps数据
- 使用dbplyr的惰性评估对大规模数据集进行分析,无需加载到内存中
- 无缝集成
dplyr和sf - 在
duckdb中与本地sf数据合并,或与sf合并 - 本地下载以供离线使用和性能优化
使用示例
示例1:查询和绘制宾夕法尼亚州县域数据
r library(overtureR) library(dplyr) library(ggplot2)
counties <- open_curtain("division_area") |> filter(subtype == "county" & country == "US" & region == "US-PA") |> transmute( id, division_id, primary = names$primary, geometry ) |> collect()
ggplot(counties) + geom_sf(aes(fill = as.numeric(sf::st_area(geometry))), color = "white", size = 0.2) + viridis::scale_fill_viridis(option = "plasma", guide = FALSE) + labs( title = "Pennsylvania Counties by Area", caption = "Data: Overture Maps" )
示例2:查询和展示山脉数据
r library(overtureR) library(dplyr)
mountains <- open_curtain(type = "*", theme = "places") |> transmute( id, primary_name = names$primary, x = bbox$xmin, y = bbox$ymin, main_category = categories$primary, primary_source = sources[[1]]$dataset, confidence, geometry ) |> filter(main_category == "mountain" & confidence > .90)
head(mountains)
本地数据下载
r library(overtureR) library(ggplot2) library(dplyr) library(rayshader)
broadway <- c(xmin = -73.9901, ymin = 40.755488, xmax = -73.98, ymax = 40.76206)
local_buildings <- open_curtain("building", broadway) |> record_overture(output_dir = tempdir(), overwrite = TRUE)
broadway_buildings <- local_buildings |> filter(!is.na(height)) |> mutate(height = round(height)) |> collect()
p <- ggplot(broadway_buildings) + geom_sf(aes(fill = height)) + scale_fill_distiller(palette = "Oranges", direction = 1) + labs(title = "Buildings on Broadway", caption = "Data: Overture Maps", fill = "")
plot_gg( p, multicore = TRUE, width = 6, height = 5, scale = 250, windowsize = c(1032, 860), zoom = 0.55, phi = 40, theta = 0, solid = FALSE, offset_edges = TRUE, sunangle = 75 )
render_snapshot(clear=TRUE)
路线图
- 读取pmtiles
- 为record_overture添加分区、分块功能
- 添加beta/alpha数据集
- 添加地图绘制指南
- 添加性能优化指南




