Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/geocode_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# City Address Candidates API Access
#
# @description Provides access to the City of Saint Louis\href{https://stlgis3.stlouis-mo.gov/arcgis/rest/services/PUBLIC/COMPPARSTRZIPHANDLE/GeocodeServer/findAddressCandidates}{Address Candidates API}
# @description Provides access to the City of Saint Louis\href{https://stlgis3.stlouis-mo.gov/arcgis/rest/services/GEOCODE/COMPOSITEGEOCODE_v4/GeocodeServer/findAddressCandidates}{Address Candidates API}
#
#
# @usage gw_add_candidates(street, zip, address, n, threshold, crs, sf)
Expand Down Expand Up @@ -34,7 +34,7 @@ gw_add_candidates <- function(street, zip, address, n, threshold, crs, sf = FALS
}

# build a query
query <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/PUBLIC/COMPPARSTRZIPHANDLE/GeocodeServer/findAddressCandidates?"
query <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/GEOCODE/COMPOSITEGEOCODE_v4/GeocodeServer/findAddressCandidates?"

if(!missing(street)){
query <- paste0(query, "Street=", utils::URLencode(street), "&")
Expand Down Expand Up @@ -231,7 +231,7 @@ gw_batch_call <- function(.data, id, address, threshold, vars = "minimal"){
query <- jsonlite::toJSON(x)
query <- jsonlite::minify(query)

url <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/PUBLIC/COMPPARSTRZIPHANDLE/GeocodeServer/geocodeAddresses"
url <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/GEOCODE/COMPOSITEGEOCODE_v4/GeocodeServer/geocodeAddresses"

response <- httr::POST(url,
body = list(addresses = query,
Expand Down Expand Up @@ -289,7 +289,7 @@ gw_add_reverse <- function(x, y, distance = 0, crs = 102696, intersection = FALS

# build a query
location <- paste0("{x:", x, ",y:", y, "}")
baseURL <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/PUBLIC/COMPPARSTRZIPHANDLE/GeocodeServer/reverseGeocode"
baseURL <- "https://stlgis3.stlouis-mo.gov/arcgis/rest/services/GEOCODE/COMPOSITEGEOCODE_v4/GeocodeServer/reverseGeocode"
query <- paste0(baseURL, "?location=", location, "&distance=", distance, "&outSR=", crs, "&returnIntersection=", intersection,
"&f=pjson")
url <- utils::URLencode(query)
Expand Down