Coder Social home page Coder Social logo

mpaulacaldas / rgeoapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colinfay/rgeoapi

0.0 1.0 0.0 55 KB

This package requests informations from the french GéoAPI inside R — https://api.gouv.fr/api/geoapi.html

License: GNU General Public License v3.0

R 100.00%

rgeoapi's Introduction

rgeoapi is now on CRAN

rgeoapi

This package requests informations from the French GeoAPI inside R — https://api.gouv.fr/explorer/geoapi/

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 :

  • ComByCode Get City by INSEE Code

  • ComByCoord Get City by Coordinates

  • ComByDep Get Cities by Department

  • ComByName Get City by Name

  • ComByPostal Get City by Postal Code

  • ComByReg Get Cities by Region

  • DepByCode Get Department by INSEE Code

  • DepByName Get Department by Name

  • DepByReg Get Departments by Region

  • RegByCode Get Region by INSEE Code

  • RegByName Get Region by Name

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.

  • A being the output you need -- Com for "Commune" (refering to French cities), Dep for Département (for Department) and Reg for Région.

  • B being the request parameter -- Code for INSEE Code, Coord for Coordinates (WGS-84), Dep for Department, Name for name, Postal for Postal Code and Reg for Region.

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 !

rgeoapi's People

Contributors

colinfay avatar pachevalier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.