Skip to content

Instantly share code, notes, and snippets.

@tiernanmartin
Created January 22, 2018 20:08
Show Gist options
  • Save tiernanmartin/ae34b8f9329878a244790a87dcaaa7ad to your computer and use it in GitHub Desktop.
Save tiernanmartin/ae34b8f9329878a244790a87dcaaa7ad to your computer and use it in GitHub Desktop.
Get OSM data for the buildings in the Chinatown International District, Seattle, WA
library(sf)
library(osmdata)
library(tidyverse)
library(miscgis)
library(mapview)
# BBOX RESOURCE: http://tools.geofabrik.de/calc/#type=geofabrik_standard&bbox=-122.33,47.595759,-122.311374,47.601725&tab=1&proj=EPSG:4326&places=4
cid_bbox <- c(-122.33, 47.5957, -122.3113, 47.6018)
cid_bldg_query <- cid_bbox %>%
opq() %>%
add_osm_feature(key = "building", value = "",value_exact = FALSE)
cid_bldg <- cid_bldg_query %>%
osmdata_sf() %>%
pluck("osm_polygons")
# plot(st_geometry(cid_bldg))
# mapview(cid_bldg)
st_write(cid_bldg, dsn = "osm_cid_bldg.shp",layer = 'osm_cid_bldg')
st_write(cid_bldg, dsn = "osm-cid-bldg.gpkg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment