All the code below was generated in one go by Chat GPT.
# Install and load the required libraries
# install.packages("osmdata")
# install.packages("mapview")
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library(mapview)
# Define the bounding box for Dublin, Ireland
bbox <- getbb("Dublin, Ireland")
# Query OpenStreetMap data for pharmacies in the specified area
osm_pharmacies <- opq(bbox = bbox, timeout = 25) %>%
add_osm_feature(key = "amenity", value = "pharmacy") %>%
osmdata_sf()
# Extract the pharmacy locations from the obtained OSM data
pharmacy_locations <- osm_pharmacies$osm_points
# Create a mapview object for the pharmacy locations and display the map
pharmacy_mapview <- mapview(pharmacy_locations)
## Warning in CPL_transform(x, crs, aoi, pipeline, reverse, desired_accuracy, :
## GDAL Error 1: PROJ: proj_as_wkt: DatumEnsemble can only be exported to
## WKT2:2019
pharmacy_mapview