is there a function/operation to add place of interest?

I am plotting springs within a place "Christchurch", however, the place does not appear when I run it only the spring locations themselves.

# packages
library(sf)
library(tmap)
library(tidyverse)
library(rmapshaper)
library(dplyr)
library(units)
library(terra) 
library(rmapshaper)
library(tidyr)
library(tmaptools)
library(tibble)
library(tidygeocoder)
library(ggplot2) # plotting spatial data
library(ggsn) # north arrow and scale bar for ggplot2
library(mapsf) # plotting spatial data
library(ggspatial)
library(ggthemes)
library(nzcensr)
library(ggrepel)

# reading spatial springs
springs_geo <- st_read("Spring_Locations.geojson")

# springs csv
springs_csv <- read.csv("Spring_Locations.csv")

# reading TA's
TA <- st_read("territorial-authority-2021-generalised.gpkg")

# transforming spring projection
springs_geo <- springs_geo %>% st_transform(crs = "EPSG:2193")

springs_csv <- springs_csv %>% transform(crs = "EPSG:2193")

# selecting variables and changing names as we go
TA <- TA %>% select(TA_code = TA2021_V1_00, TA_name = TA2021_V1_00_NAME, land_area_sq_km = LAND_AREA_SQ_KM,
                    area_sq_km = AREA_SQ_KM, shape_length = Shape_Length, geometry = geom)

# filtering greater CHCH springs geo only
springs_geo_chch <- springs_geo %>%
  st_filter(TA %>% filter(TA_name == "Christchurch City"))

# geocoding
springs_chch_loc <- geocode_OSM(springs_chch$ROAD_OR_STREET, projection = 4326, as.sf = TRUE)

springs_chch_loc <- springs_chch_loc %>% st_transform(crs = "EPSG:2193")




tmap_mode("plot")


tm_shape(shp = springs_geo_chch, 
         bbox = "Christchurch") +
  tm_dots(col = "red",
          title = "Christchurch Spring Locations",
          alpha = 1,
          size = 0.2) +
  tm_scale_bar(position = c("right", "bottom"), 
             breaks = c(0,1,2)) +
  tm_credits("Data: Canterbury Regional Council, 2016", 
           position=c("right", "bottom"), 
           size = 0.8) +
  tm_compass(position = c("right", "top"), 
             size = 1.5, 
             show.labels = T, 
             color.light = "black") + 
  tm_layout(bg.color = "lightcyan", 
            frame = T, 
            legend.position = c("left","top"),
            title = "Locations of Springs in Christchurch", 
            title.size = 1.5,
            title.fontface = "bold",
            legend.title.size = 0.8,
            legend.text.size = 0.6)

Would this be due to a geocoding issue, I am new to programming so am unsure of this.

Are you just after a dataset that contains places of interest? I assume that you are in NZ. Surely you can find something on LINZ?

https://data.linz.govt.nz/search/

Or are you after something else?

By the way, we can't reproduce your map because we don't have your data.

I just kind of want to show the outline/map of Christchurch along with the spring locations
The spring locations are there just not Christchurch
, must I download a new data set for this?

Some options:

https://data.linz.govt.nz/layer/51153-nz-coastlines-and-islands-polygons-topo-150k/

https://www.spatialanalytics.co.nz/post/2018/11/01/plotting-new-zealand-with-r/

https://r-resources.massey.ac.nz/lurn/LURNch18.html

Another option might be to use leaflet, tmap or mapview and add a basemap to it. Not other download required and the maps are interactive.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.