library(googlesheets)
library(dplyr)
library(tidyr)
library(magrittr)
library(leaflet)
library(htmltools)
library(magick)
library(DT)
library(leaflet.extras)

Weekly photograph

I started this weekly photograph project in September 2015, in order to force myself to invest some time in photography (one of my many passions) on a regular basis. Back then I decided to host all photos on 500px. I have licensed all photos under CC BY-NC-SA 3.0 now, so all photos can be downloaded for free, and used within the restrictions provided by the license. At 500px, it seems however that downloading the high-resolution versions is not possible for photos under this license, so I am providing links to the high-resolution versions in the map and list below. At the moment, this project is on a break after reaching a number of 100 weekly photographs in July 2017, but it might be continued at some point.

dat <- gs_read(gs_title("photo-projects"), "weekly-photograph")
dat <- dat %>%
  separate(coordinates, sep = ":", into = c("na", "coordinates")) %>% 
  separate(coordinates, c("lat", "lng", "z"), ",") %>% 
  mutate(lat = as.numeric(lat), lng = as.numeric(lng)) 
dat$width <- dat$height <- NA
for(i in 1:nrow(dat)) {
  read_img <- image_read(dat$img[i])
  dat$width[i] <- dim(read_img[[1]])[2]
  dat$height[i] <- dim(read_img[[1]])[3]
}
dat <- dat %>% 
  mutate(popup = paste0('<center><img src="',img,'" height="',100,'"" width="',width/height*100,'"></center><br/><b>',htmlEscape(name), '</b><br/>',description, ifelse(is.na(location),"",location),'<br/><a href="', url, '">500px page</a> - <a href="',original,'">high-resolution version</a>'))

The map

This map shows all locations (approximate; I’m geotagging manually with digiKam) of the 100 photos, and provides popups with the actual images, titles, descriptions and links to the 500px page and high-resolution versions.

leaflet(dat, width = 807, height = 500) %>% 
  addProviderTiles("Esri.WorldImagery") %>% 
  addCircleMarkers(lng = ~lng,
             lat = ~lat,
             popup = ~popup,
             label = ~htmlEscape(name),
             clusterOptions = markerClusterOptions(showCoverageOnHover = FALSE),
             stroke = FALSE, radius = 6, fillOpacity = 0.7) %>% 
  addScaleBar() %>% 
  addFullscreenControl()


The table

In the table below, you can find the same information as that provided in the map popups.

datatable(dat %>% select(nr, date, name, description, location, url, original) %>%
            mutate(url = paste0('<a href="', url, '">link</a>'), original = paste0('<a href="',original,'">link</a>')) %>% 
            mutate(description = paste(description, location)) %>% 
            select(-location) %>% 
            rename(title = name, `500 px page` =url, `high-resolution version` = original), rownames = FALSE, escape = FALSE, class = 'cell-border stripe')

Copyright © 2017 Bart Rogiers. All rights reserved.