Appendix I — Comparative Assessment of QualoCEP and Google Geocoding API Performance
I.1 Overview
This document outlines a workflow to evaluate the geocoding performance of QualoCEP in comparison to the Google Geocoding API. The comparison focuses on latitude and longitude outputs to assess the consistency and reliability of both services, which are integral to the geocoding tasks in this thesis.
To execute this notebook, ensure you have a valid Google Geocoding API key stored in your .Renviron
file. For detailed instructions on obtaining and configuring the API key, refer to the tidygeocoder
R package documentation.
I.2 Setting the Environment
I.3 Importing QualOCep Data
Code
qualocep_data <- get_qualocep_data()
I.4 Random Test 1
I.4.1 QualOCep Data
Code
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = sample_data$longitude,
lat = sample_data$latitude,
popup = paste0(
"Latitude: ", sample_data$latitude, "<br>",
"Longitude: ", sample_data$longitude
)
)
I.4.2 Google Geocoding API
Code
google_data <-
sample_data |>
dplyr::mutate(
address = orbis::render_brazil_address(
street = sample_data$street,
complement = sample_data$complement,
neighborhood = sample_data$neighborhood,
municipality = sample_data$municipality,
state = sample_data$state,
postal_code = sample_data$postal_code
)
) |>
tidygeocoder::geocode(
address = address,
method = "google"
)
#> Passing 1 address to the Google single address geocoder
#> Query completed in: 0.9 seconds
google_data |> as.list() |> rutils:::list_as_tibble()
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = google_data$longitude,
lat = google_data$latitude,
popup = paste0(
"Latitude: ", google_data$latitude, "<br>",
"Longitude: ", google_data$longitude
)
)
I.5 Random Test 2
I.5.1 QualOCep Data
Code
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = sample_data$longitude,
lat = sample_data$latitude,
popup = paste0(
"Latitude: ", sample_data$latitude, "<br>",
"Longitude: ", sample_data$longitude
)
)
I.5.2 Google Geocoding API
Code
google_data <-
sample_data |>
dplyr::mutate(
address = orbis::render_brazil_address(
street = sample_data$street,
complement = sample_data$complement,
neighborhood = sample_data$neighborhood,
municipality = sample_data$municipality,
state = sample_data$state,
postal_code = sample_data$postal_code
)
) |>
tidygeocoder::geocode(
address = address,
method = "google"
)
#> Passing 1 address to the Google single address geocoder
#> Query completed in: 0.3 seconds
google_data |> as.list() |> rutils:::list_as_tibble()
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = google_data$longitude,
lat = google_data$latitude,
popup = paste0(
"Latitude: ", google_data$latitude, "<br>",
"Longitude: ", google_data$longitude
)
)
I.6 Random Test 3
I.6.1 QualOCep Data
Code
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = sample_data$longitude,
lat = sample_data$latitude,
popup = paste0(
"Latitude: ", sample_data$latitude, "<br>",
"Longitude: ", sample_data$longitude
)
)
I.6.2 Google Geocoding API
Code
google_data <-
sample_data |>
dplyr::mutate(
address = orbis::render_brazil_address(
street = sample_data$street,
complement = sample_data$complement,
neighborhood = sample_data$neighborhood,
municipality = sample_data$municipality,
state = sample_data$state,
postal_code = sample_data$postal_code
)
) |>
tidygeocoder::geocode(
address = address,
method = "google"
)
#> Passing 1 address to the Google single address geocoder
#> Query completed in: 0.2 seconds
google_data |> as.list() |> rutils:::list_as_tibble()
Code
leaflet::leaflet() |>
leaflet::addTiles() |>
leaflet::addMarkers(
lng = google_data$longitude,
lat = google_data$latitude,
popup = paste0(
"Latitude: ", google_data$latitude, "<br>",
"Longitude: ", google_data$longitude
)
)