README.md

rgeoapi is now on CRAN

rgeoapi

This package requests informations from the French GeoAPI inside R — https://api.gouv.fr/api/api-geo.html

GeoAPI

Developped by Etalab, with La Poste, l’INSEE and OpenStreetMap, the GeoAPI API is a JSON interface designed to make requests on the French geographic database.

rgeoapi was developped to facilitate your geographic projects by giving you access to these informations straight inside R. With rgeoapi, you can get any coordinate, size and population of a French city, to be used in your maps.

For an optimal compatibility, all the names (especially outputs) used in this package are the same as the ones used in the GeoAPI. Please note that this package works only with French cities.

Install rgeoapi

Install this package directly in R :

devtools::install_github("ColinFay/rgeoapi")

How rgeoapi works

The version 1.0.0 works with eleven functions. Which are :

How the functions are constructed

In the GeoAPI, you can request for "Commune", "Département" or "Région". All the functions are constructed using this terminology : AByB.

Some examples

ComByCoord

Takes the latitude and longitude of a city, returns a data.frame with name, INSEE code, postal code, INSEE department code, INSEE region code, population (approx), surface (in hectares), lat and long (WGS-84).

ComByCoord(lat = "48.11023", lon = "-1.678872") 

DepByName

This function takes a character string with the name of the department, and returns a data.frame with name, INSEE code, and region code. Partial matches are possible. In that case, pertinence scores are given.

DepByName("morbihan")
DepByName("Il")

RegByCode

This function takes an INSEE Code, returns a data.frame with name and region code.

RegByCode(53)

French Tutorial & contact

A French tutorial on my website. Questions and feedbacks welcome !



ColinFay/rgeoapi documentation built on May 6, 2019, 12:22 p.m.