Travis build
status AppVeyor build

The goal of photomapr is to make it easier to create photomaps. A photomap is an interactive map which shows the location of places where photos have been taken. Ideally, photomaps should be able to display the photo of interest when you click on it.

Why create your own photomaps?

Photomaps and photo albums are a great way to share experiences and remember good times. A good example of a photomap is that created by default by Flickr when an album of geotagged photos has been created. The image below shows a publicly available Flickr photomap, showing photos taken during a cycling holiday from the Knepp Estate rewilding project to Lewes, which ended by passing though Marble Arch in London.

This approach has limitations, however. You must sign-up to Flickr and other services that create photomaps ‘in the cloud’, creating a barrier to entry. Furthermore, creating a photomap online often involves sending valuable and sometimes highly personal data to corporations. That can be problematic, as outlined in the book and podcast series Team Human by Douglas Rushkoff.

This package aims to make it easy to create photomaps locally and, if you want, deploy the results online. An example of photomaps is, a photomap developed using an early version of this package, a screenshot of which is shown below (see here to see how the package was used to create this photobook containing photomaps).


Install development version from GitHub with:

# install.packages("devtools")


The first stage is to decide the photos you want. The package cannot help you with that, but once you do have a number of photo files, represented by photo_files below, you can convert them to a geographic data frame with the function photos_sf():


(photo_files = geotagged_photo_paths())
#> [1] "/home/robin/R/x86_64-pc-linux-gnu-library/4.2/photomapr/photos/IMG_20190523_120605_logo.jpg"
#> [2] "/home/robin/R/x86_64-pc-linux-gnu-library/4.2/photomapr/photos/IMG_20190523_135034_logo.jpg"
#> [3] "/home/robin/R/x86_64-pc-linux-gnu-library/4.2/photomapr/photos/IMG_20190524_104545_logo.jpg"
#> [4] "/home/robin/R/x86_64-pc-linux-gnu-library/4.2/photomapr/photos/IMG_20190524_110720_logo.jpg"
#> [5] "/home/robin/R/x86_64-pc-linux-gnu-library/4.2/photomapr/photos/IMG_20190524_200945_logo.jpg"
photos_geo = photos_sf(photo_files)
plot(photos_geo["DateTimeOriginal"], key.pos = 1)

Let’s create a simple photomap, using data shipped in the package:


You can also preview your photos with a slideshow in RStudio:


How it works

The package works bringing together functionality from a number of excellent packages, including:

Thanks to the developers of these packages, and to everyone making and using open source software. Without you this project would be impossible.

Example workflow

photos_zip = "/media/robin/T7/ColwallHerefordshire/"
photos_path = gsub(pattern = ".zip", replacement = "", x = photos_zip)
unzip(zipfile = photos_zip, exdir = photos_path)
photos_path = file.path("/media/robin/T7/ColwallHerefordshire/Colwallgeotaggedimages/mPix12Oct/")
photos_files = list.files(photos_path, full.names = TRUE)
p_sf = photos_sf(photos_files)
photos_to_keep = 1:9
p_sf_test = p_sf |> 
  slice(photos_to_keep) |> 
  transmute(file = basename(path = SourceFile)) |> 
  mutate(file = paste0('<a href="', file, '">', file, '</a>'))

file.copy(from = photos_files[photos_to_keep], to = "testphotofolder")
f = list.files("testphotofolder", full.names = TRUE)
l = leaflet() |> 
  addTiles() |> 
  addMarkers(data = p_sf_test, popup = p_sf_test$file)
htmlwidgets::saveWidget(widget = l, file = "testphotofolder/index.html")
system("zip -r testphotofolder")

Next steps

Robinlovelace/photomapr documentation built on Oct. 21, 2022, 7:21 a.m.