OpenStreetMap

Using Overpass to add metadata to churches in Anchorage

Posted by Hans Thompson on 31 July 2020 in English (English)

I’ve done a good amount of work to add basic geometry to Anchorage in the past. Now, I would like to store more data inside the polygons for buildings that have been created.

It is a difficult task to do quality control on the wide number of churches, schools, businesses, etc. in Anchorage because it is just too big. 100’s of buildings in each category where there are also points or multipolgons as well. To accomplish a definitive test of which polygons of a certain type have a data tag, I’ll need to use the overpass API. Fortunately, the work has mostly been done to use it as a tool by relying on R and the library osmdata.

For example, I’ve been able to query all of the amenities with “place_of_worship” to see what tags are available, and map the polygons on top of an osm basemap with the following code.

library(osmdata)
library(leaflet)
library(dplyr)
x <- opq(bbox = c(-150.092146, 61.483194, -148.981596, 60.814537)) %>% 
  add_osm_feature(key = 'amenity', value = "place_of_worship", value_exact = FALSE) %>%
  osmdata_sf()
y <- x$osm_polygons %>% filter(is.na(denomination))
leaflet(y) %>% addTiles() %>% addPolygons(popup = ~y$name)
y %>% as.data.frame() %>% select(name, email, website, phone, denomination) 

…This will show me which places of worship still need to have a denomination added. And I reuse this for different tags I want to add.

Login to leave a comment