Flight patterns of the Kleine Mantelmeeuw

Data from service via OpenEarth stack

Available via WFS (csv) http://marineprojects.openearth.nl/geoserver/shwoz/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shwoz:kleinemantelmeeuw&OutputFormat=csv

url <- "http://marineprojects.openearth.nl/geoserver/shwoz/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shwoz:kleinemantelmeeuw&OutputFormat=csv"

Meeuw <- read_csv(url, col_types = "ciccid", n_max = 20000)
Meeuw <- Meeuw[17000:20000,]

Meeuw$datetime <- as.POSIXct(Meeuw$datetime, format = "%Y-%m-%dT%H:%M:%S")

WKT omzetten naar lat en long met readWKT functie

using package rgeos Since the readWKT function is not vectorized (it can not handle vectors, only single geometries) you need to split the dataframe, and apply the function on each element in the wkt column

xy = adply(Meeuw, 1, mutate,
           long = as.data.frame(readWKT(geom))[,1],
           lat = as.data.frame(readWKT(geom))[,2])

check data

qplot(datetime, altitude, data = xy, geom = "path")

qplot(datetime, speed, data = xy, geom = "path")

interactive map using leaflet

Identify favourite resting places of the kleine mantelmeeuw. The color indicates the altitude of the bird, the size the speed (big dots = low speed). Leaflet is a lightweight map service which can be directly bound by R through the package Rleaflet.

Map

#define colors for eacht individual
xy <- xy[!is.na(xy$altitude),]
xy <- xy[xy$altitude >= 0, ]
xy <- xy[xy$speed < 100,]
sorted.xy <- xy[order(xy$altitude),]
# make map
numpal <- colorNumeric(rainbow(10), xy$altitude)
leaflet() %>%
  addTiles(group = "OSM (default)") %>%
  addProviderTiles("Hydda.Base", group = "Hydda Base") %>%
  addProviderTiles("Stamen.TonerLite", group = "Toner Lite") %>%
  addProviderTiles("Esri.WorldImagery", group = "ESRI Imagery") %>%
  # addTiles(group = "OSM (default)") %>%
  addCircleMarkers(data=sorted.xy,
                   popup = sprintf(as.character(paste("id:",sorted.xy$devid," h:", sorted.xy$altitude, "v", round(sorted.xy$speed,1)))),
                   # clusterOptions = markerClusterOptions(),
                   radius = ~30/(speed + 5),
                   color = ~numpal(altitude),
                   stroke = F,
                   fillOpacity = 0.7)  %>%
  addLayersControl(
    baseGroups = c("OSM (default)", "Hydda Base", "Toner Lite", "Esri"),
    options = layersControlOptions(collapsed = FALSE))

#  addLayersControl(options = layersControlOptions(collapsed = FALSE))
  • No labels