03/12/2020

Intoduction

This README file is an R Markdown presentation introducing the application made with the Shiny framework and hosted on Shiny servers: Toulouse Map.
To see the present file in presentation view use the following link hosting it on RPubs : Shiny App presentation.
All codes files (presentation markdown + shiny R codes) are available on my Github page.

In France, there is some confusion about postal codes as there are different databases with certain exclusive postal codes. This can be problematic in the search for address or geographical location.

The purpose of the application is to show the geographical areas linked to the postal codes of the city of Toulouse and its surroundings, in the south of France.

Post code

The official post code system links each municipality to a postal code. These postal codes are decided by INSEE (Insee is a french official public statistical institute) and this metric is often called the INSEE postal code.

However, La Poste, which is the French public and main postal services company uses a postal code database similar to the one deliver by INSEE, but with many tweaks. These changes in some postal codes compared to the official database are used to improve the delivery and layout of La Poste offices.

Post code

The two databases are used just as much, and therefore can lead to some confusion, especially since there is other systems also used.

Since I live in Toulouse, I’m interested to get a map of the city and its surroundings with the geographical areas linked to both post code databases.

On Data.toulouse-metropole both datasets can be gather as geojson files :
- codes-postaux-de-toulouse dataset, from La Poste, with last data input on 2020-12-01
- communes dataset, from Toulouse Metropole, with last data input on 2020-12-01
both are made available under the Open Database License (local license text). Any rights in individual contents of the database are licensed under the Database Contents License.

Post code

Here’s an overview of theses datasets

library(geojsonio)
geojson_read("./ToulouseMapApp/data/codes-postaux-de-toulouse.geojson", what = "sp") %>% as.data.frame() %>% head(3)
##   code_postal id_code_postal        geo_point_2d
## 1       31130              3 43.604213, 1.528549
## 2       31770             17 43.611717, 1.326944
## 3       31270              9 43.534212, 1.334696
geojson_read("./ToulouseMapApp/data/communes.geojson", what = "sp") %>% as.data.frame() %>% head(3)
##              libcom           libelle code_insee code_fantoir
## 1     TOURNEFEUILLE     Tournefeuille      31557       310557
## 2     DREMIL LAFAGE     Drémil-Lafage      31163       310163
## 3 QUINT FONSEGRIVES Quint-Fonsegrives      31445       310445
##          geo_point_2d
## 1 43.578320, 1.335061
## 2 43.591307, 1.602786
## 3 43.581292, 1.542891

Base map

The map is set by Leaflet Framework and polygons are drawn with the geojson files objects. Here’s the background map.

library(leaflet)
leaflet() %>% setView(lat = 43.6016, lng = 1.4407, 11) %>% 
      addProviderTiles(providers$CartoDB.Positron)