MyNixOS website logo
Description

Client for the 'BAN' API.

A client for the 'Base Adresses Nationale' ('BAN') API, which allows to (batch) geocode and reverse-geocode French addresses. For more information about the 'BAN' and its API, please see <https://adresse.data.gouv.fr/outils/api-doc/adresse>.

An R client for the BAN API

R buildstatus

The banR package is a light R client for the BAN API. The Base Adresse Nationale (BAN) is an open database of French adresses, produced by OpenStreetMap, La Poste, the IGN and Etalab.

banR can be installed from Github (current version):

# install.packages("devtools")
devtools::install_github("joelgombin/banR", build_vignettes = TRUE)

The CRAN version is out of date :

install.packages("banR")

banR allows to geocode a single adress directly (limited to 50 requests per second from the same IP address) or lots of adresses in batch (the only hard limit is that, at the moment, the API only allows CSV files up to 50 MB).
Please be gentle with the server though!

banR is designed to be used in a data exploration workflow, with a syntax 'à la tidyverse':

library(dplyr)
#> 
#> Attachement du package : 'dplyr'
#> Les objets suivants sont masqués depuis 'package:stats':
#> 
#>     filter, lag
#> Les objets suivants sont masqués depuis 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(banR)
data("paris2012")

paris2012 %>%
  slice(1:100) %>%
  mutate(adresse = paste(numero, voie, nom),
         code_insee = paste0("751", arrondissement)) %>% 
  geocode_tbl(adresse = adresse, code_insee = code_insee) %>%
  glimpse()
#> Writing tempfile to...C:\Users\JULIET~1.ENG\AppData\Local\Temp\Rtmpk3wFQ5\file697c6c89434c.csv
#> If file is larger than 50 MB, it must be splitted
#> Size is : 3 Kb
#> SuccessOKSuccess: (200) OK
#> Rows: 100
#> Columns: 27
#> $ arrondissement     <chr> "06", "06", "06", "06", "06", "06", "06", "06", "06…
#> $ bureau             <chr> "09", "09", "09", "09", "09", "09", "09", "09", "09…
#> $ numero             <int> 4, 5, 6, 7, 8, 11, 12, 13, 14, 16, 3, 4, 5, 6, 7, 8…
#> $ voie               <chr> "RUE DE L", "RUE DE L", "RUE DE L", "RUE DE L", "RU…
#> $ nom                <chr> "ABBAYE", "ABBAYE", "ABBAYE", "ABBAYE", "ABBAYE", "…
#> $ nb                 <int> 1, 1, 20, 2, 17, 2, 9, 15, 17, 8, 13, 6, 6, 3, 9, 1…
#> $ ID                 <chr> "0609", "0609", "0609", "0609", "0609", "0609", "06…
#> $ adresse            <chr> "4 RUE DE L ABBAYE", "5 RUE DE L ABBAYE", "6 RUE DE…
#> $ code_insee         <chr> "75106", "75106", "75106", "75106", "75106", "75106…
#> $ longitude          <dbl> 2.335715, 2.335172, 2.335352, 2.335041, 2.334903, 2…
#> $ latitude           <dbl> 48.85405, 48.85407, 48.85414, 48.85410, 48.85425, 4…
#> $ result_score       <dbl> 0.9663627, 0.9663627, 0.9663627, 0.9663627, 0.96636…
#> $ result_score_next  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ result_label       <chr> "4 Rue de l'Abbaye 75006 Paris", "5 Rue de l'Abbaye…
#> $ result_type        <chr> "housenumber", "housenumber", "housenumber", "house…
#> $ result_id          <chr> "75106_0002_00004", "75106_0002_00005", "75106_0002…
#> $ result_housenumber <chr> "4", "5", "6", "7", "8", "11", "12", "13", "14", "1…
#> $ result_name        <chr> "4 Rue de l'Abbaye", "5 Rue de l'Abbaye", "6 Rue de…
#> $ result_street      <chr> "Rue de l'Abbaye", "Rue de l'Abbaye", "Rue de l'Abb…
#> $ result_postcode    <chr> "75006", "75006", "75006", "75006", "75006", "75006…
#> $ result_city        <chr> "Paris", "Paris", "Paris", "Paris", "Paris", "Paris…
#> $ result_context     <chr> "75, Paris, Île-de-France", "75, Paris, Île-de-Fran…
#> $ result_citycode    <chr> "75106", "75106", "75106", "75106", "75106", "75106…
#> $ result_oldcitycode <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ result_oldcity     <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ result_district    <chr> "Paris 6e Arrondissement", "Paris 6e Arrondissement…
#> $ result_status      <chr> "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok…

To know more about this package, please read the vignette (vignette("geocode"))

Please report issues and suggestions to the issues tracker.

See also

  • BAN-geocoder, python wrapper for adresse.data.gouv.fr
  • tidygeocoder, r package similar to banR using other geocoding services such as US Census geocoder, Nominatim (OSM), Geocodio, and Location IQ.
Metadata

Version

0.2.4

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows