Publications by Michael
Where and when (not) to eat in France ?
Results of sanitary controls in France can be found on data.gouv.fr however, only the running year is available… Thanks to @[email protected] we can access the archives since 2017. First a global view of the dataset : About 800 controls per week, except during the lock-down in 2020, and a slightly lower control pressure in 2021 and 2022. Poor r...
1539 sym 14 img
Cherry blossom
It’s cherry blossom time… A nice dataset going back to the year 812 in Kyoto can be found here. It describes the phenological data for full flowering date of cherry tree (Prunus jamasakura) in Kyoto, showing springtime climate changes. Let’s draw… # params ------------------------------------------------------------------ url_kyoto <- "ht...
643 sym R (2907 sym/1 pcs) 2 img
Open and merge multiple shapefiles, updated
This old post sees a little traffic from search engines but is a mess after many editions due to the packages evolutions. So, how can we (chose your term) append, merge, union or combine many shapefiles or other spatial vector data in 2023 with R, preferably using tidyverse functions ? For good measure, we want to add the source file as an attribut...
1251 sym R (1347 sym/7 pcs) 2 img
One neighbour
Today I saw this : So, Portugal has only one terrestrial neighbour. Opencage lists the other countries with only one neighbour. Can we get this by ourselves ? library(tidyverse) library(rnaturalearth) library(spdep) # get data from Natural Earth countries <- ne_countries(scale = 10, returnclass = "sf") |> st_make_valid() |> group_by(sov_a3,...
807 sym R (2679 sym/3 pcs) 4 img
Population growth
I just saw this article in Le Monde : « a pair of cats can produce 20,000 individuals in just four years ». (translation) That seems quite high… Let’s check! (additionally, the article is about feral cats preying on wildlife but we are shown a wild cat capturing a laboratory mouse!) This figure could come from a back-of-the-envelope calcul...
3378 sym R (1486 sym/2 pcs) 4 img
Map your Strava activities
Use the Strava API to map your outings with R using the {rStrava} package. library(tidyverse) library(leaflet) library(rStrava) library(sf) # Get your credentials from https://www.strava.com/settings/api app_name <- "*******" client_id <- "*******" client_secret <- "*******" #' Convert Google polylines from Strava activities to {sf} polylines #...
470 sym R (997 sym/1 pcs) 2 img
Use data from Openstreetmap
Day 5 of 30DayMapChallenge : « Ukraine » (previously). Using {osmdata} to extract streets : library(dplyr) library(ggplot2) library(sf) library(osmdata) library(ggspatial) library(glue) ua_bbox <- getbb("kiev, ukraine", featuretype = "city") ua <- opq(ua_bbox) %>% add_osm_features(features = c('"highway"="primary"', ...
491 sym R (1373 sym/1 pcs) 2 img
Opening a spatial subset with {sf}
Intersecting an area of interest with a layer at opening time Days 3 and 4 of 30DayMapChallenge : « polygons » and « green » (previously). The CORINE Landcover dataset is distributed as a geopackage weighting more than 8 Go. To limit the memory used when we only work on a subset, we can clip it at opening time. Here we will map the Cyprus...
761 sym R (1725 sym/1 pcs) 2 img
Food
Day 15 of 30DayMapChallenge : « food » (previously). Results of State food controls in restaurants in La Réunion. library(dplyr) library(sf) library(janitor) library(mapsf) library(glue) library(lubridate) # https://geoservices.ign.fr/adminexpress # COG dep <- read_sf("~/ADE-COG_2-1_SHP_WGS84G_FRA/DEPARTEMENT.shp") %>% filter(INSEE_DEP ...
522 sym R (1625 sym/1 pcs) 2 img
Sugar
Day 13 of 30DayMapChallenge : « 5 minutes map » (previously). Sugar cane fields in La Réunion library(tidyverse) library(sf) # RPG région La Réunion édition 2021 # https://wxs.ign.fr/0zf5kvnyfgyss0dk5dvvq9n7/telechargement/prepackage/RPG_REGION_PACK_DIFF_2021-01-01$RPG_2-0__SHP_RGR92UTM40S_R04_2021-01-01/file/RPG_2-0__SHP_RGR92UTM40S_R0...
493 sym R (1137 sym/1 pcs) 2 img