Skip to contents

Implementation of the "RPG" module from the IGN's apicarto. This function is a wrapper around version 1 and 2 of the API.

Usage

get_apicarto_rpg(x,
                 annee,
                 code_cultu = NULL,
                 dTolerance = 0L,
                 progress = FALSE)

Arguments

x

Object of class sf. Needs to be located in France.

annee

numeric between 2010 and 2023.

code_cultu

character corresponding to code culture, see detail.

dTolerance

numeric; tolerance parameter. The value of dTolerance must be specified in meters, see detail.

progress

Display a progress bar? Use TRUE to turn on a basic progress bar, use a string to give it a name. See httr2::req_perform_iterative().

Value

list or object of class sf

Details

Since 2014 the culture code has changed its format. Before it should be a value ranging from "01" to "28", after it should be a trigram (ex : "MIE"). More info can be found at the documentation page

dTolerance is needed when geometry are too complex. Its the same parameter found in sf::st_simlplify.

Examples

if (FALSE) { # \dontrun{
library(sf)

penmarch <- get_apicarto_cadastre("29158", type = "commune")

# failure with too complex geom
rpg <- get_apicarto_rpg(st_buffer(penmarch, 10), 2020)

# avoid complex data by setting dTolerance
rpg <- get_apicarto_rpg(penmarch, 2020, dTolerance = 15)

# multiple years after 2014
rpg <- get_apicarto_rpg(penmarch, 2020:2021, dTolerance = 15)

# years before and after 2014
# list is returned because attributs are different
rpg <- get_apicarto_rpg(penmarch, c(2010, 2021), dTolerance = 15)

# filter by code_cultu
rpg <- get_apicarto_rpg(penmarch, 2021, code_cultu = "MIE", dTolerance = 15)

# all "MIE" from 2020 and all "PPH" from 2021
rpg <- get_apicarto_rpg(penmarch, 2020:2021,
                        code_cultu = c("MIE", "PPH"),
                        dTolerance = 15)

# vectorization : all "MIE" from 2020 and 2021
rpg <- get_apicarto_rpg(x, 2020:2021, code_cultu = "MIE", dTolerance = 15)
} # }