Skip to content

Instantly share code, notes, and snippets.

@mhermans
Last active June 26, 2020 13:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhermans/6aaf83bd07a702c401ffc0000ce5863b to your computer and use it in GitHub Desktop.
Save mhermans/6aaf83bd07a702c401ffc0000ce5863b to your computer and use it in GitHub Desktop.
Map live Ghent sheep location
# API docs Real time locatie schapen Gent
# https://data.stad.gent/explore/dataset/sheep-tracking-gent/information/
library(httr)
library(leaflet)
library(lubridate)
sheep_data <- content(GET('https://data.stad.gent/api/records/1.0/search/?dataset=sheep-tracking-gent'))$records[[1]]
leaflet() %>% addTiles() %>% addMarkers(
lng = sheep_data$geometry$coordinates[[1]],
lat = sheep_data$geometry$coordinates[[2]],
label = stamp_time("Sheep last seen here at 12:00")(ymd_hms(sheep_data$record_timestamp)),
labelOptions = labelOptions(textsize = '20px', noHide = TRUE, offset = c(-20,-5)),
icon = list(
iconUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Sheep_icon_05.svg/455px-Sheep_icon_05.png',
iconSize = c(45, 45)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment