hacking_religion_cookbook/openstreetmap_parse.R
2023-10-12 09:14:32 +01:00

25 lines
1 KiB
R

require(sqldf) # using sqldf to filter while loading very large data sets
require(data.table)
require(sf) # new simplefeature data class, supercedes sp in many ways, also includes gdal functions
# setup workspace
setwd("/Users/kidwellj/gits/mapping_worship")
if (dir.exists("data") == FALSE) {
dir.create("data")}
# Import filtered geojson files
# Note: preferred option here is to use R package osmdata, but the server loads generated by this extraction are too high and cause timeouts.
# Processing data outside R using osmium for now: https://github.com/mapcomm/cookbook/blob/master/osm_extracts/osm_extract_pow_osmium_uk.sh
osm_uk_points <- st_read(system.file("pow_osm.gpkg", package = "spData"))
vector_filepath = system.file("data/osm-gb-2018Aug29_pow_osm.pbf", package = "sf")
osm_uk_points = st_read(vector_filepath)
rbind(osm_uk_points, ___)
# Processing handled outside R for now in QGIS
# Command for identifying candidates in OSM raw csv files: grep -E 'Masjid|islamic|muslim|mosque|Madrasah|Imam' *|wc -l