tl;dr

I made Wot3LdnEmojis: a London-only clone of What3Emojis using London-related emojis and very little R code.

Hover over a grid cell to get the emoji-triplet reference. Zoom and pan, change to dark mode, toggle the grid.

U wot m8

By now you’ve heard about various ‘alternative’ location systems that split the world into a grid and assign each with a value that’s more human-interpretable than latitude and longitude. For example, Google Plus Codes and What3Words.

The latter has been in the news a lot.1 In the meantime, their product has spawned a raft of spoofs, like the NSFW Four Kings Map, What3Emojis and What2Numbers, lol.2

I like What3Emojis because it’s tongue-in-cheek3, yes, but they also understand the 21st Century mantra that:

No system is perfect, except for emoji.

The What3Emojis code is openly available, but of course I wondered how easy it would be to make something like this in R.

I’ve limited it to London because us Londoners aren’t aware of anything outside of the M25. Read on for the how-to of this obnoxiously-named, cockney-baiting Wot3LdnEmojis system.

First we need to attach the {sf} package for geospatial operations; {leaflet} for interactive mapping; and {tidyverse} for data wrangling. We’ll also set a seed here for reproducible results.4

library(sf)
library(leaflet)
suppressPackageStartupMessages(library(tidyverse))
set.seed(9002488)

We can grab the official Greater London boundary from a GeoJSON of geographic units in the UK5, which is served by the Open Geography Portal from the Office for National Statistics.

Or we would, if the site wasn’t down when I went to run this. Instead, we can use the handy JSONs hosted by Martin Chorley on GitHub. Hero.

nuts_path <- paste0(
"https://raw.githubusercontent.com/martinjc/UK-GeoJSON/",
"master/json/eurostat/ew/nuts1.json"
)

ldn_sf <- st_read(nuts_path, quiet = TRUE) %>%
filter(NUTS112NM == "London")

ldn_sf
## Simple feature collection with 1 feature and 2 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -0.5102962 ymin: 51.28676 xmax: 0.3339957 ymax: 51.69187
## Geodetic CRS:  WGS 84
##   NUTS112CD NUTS112NM                       geometry
## 1       UKI    London MULTIPOLYGON (((-0.3210316 ...

So, it’s an sf-class object that behaves like a dataframe, but has some extra geospatial information stored in it.

We’ve got the boundary, how do we do a grid?

What3Emojis say they used ‘gazillions of 4m×4m triangles’ in their grid, but I don’t have the computing power for that and I can’t count that high.

Instead, I bring you low-fidelity, massive hexagons. But hexagons are the patron shape of R users, so I think that’s okay.

{sf} has st_make_grid() makes gridding easy. We can pass arguments for size and shape, then st_intersection() limits the grid to the area inside the London boundary only.

grid_sf <- ldn_sf %>%
st_make_grid(cellsize = 0.01, square = FALSE, flat_topped = TRUE) %>%
st_intersection(ldn_sf)

length(grid_sf)
## [1] 2554

I’ve checked the length of the object so we know how many grid cells we need to label uniquely. The fewest number of emoji we’ll need is therefore 14, since 14^3 is 2744.

Of course, I have chosen emojis that at least vaguely represent London. Below I’ve added names and commented with my interpretation. Let me know if you have better ideas.

ldn_emo <- c(
metro           = "🚇",  # the tube
guard           = "💂",  # Queen's Guard
queen           = "👸",  # HMQE2
castle          = "🏰",  # Tower of London
ferris_wheel    = "🎡",  # London Eye
bell            = "🔔",  # Big Ben (not a clock!)
whale           = "🐋",  # Natural History Museum
cityscape       = "🏙️",  # Canary Wharf
cucumber        = "🥒",  # The Gherkin
performing_arts = "🎭",  # Theatre District
dragon          = "🐉",  # City of London emblem
bird            = "🐦",  # pigeon
deciduous_tree  = "🌳"   # London plane tree
)

Depending on your operating system, there’s a chance you might note be able to see some of these emoji. Oh no! Ah well.

You may also have noticed that it’s utterly ridiculous to use London-related emojis to label locations in London. ‘Where are you?’ ‘London Eye, London Eye, London Eye’. ‘You’re at the London Eye?’ ‘No.’ Oh no! Ah well.

Anyway, we can get all three-way combinations of these with expand.grid(), then shuffle them randomly.

ldn_emo_combo <- expand.grid(
emo_a = ldn_emo, emo_b = ldn_emo, emo_c = ldn_emo
) %>%
sample_n(length(grid_sf)) %>%
transmute(emo_triplet = paste(emo_a, emo_b, emo_c))

ldn_emo_combo$emo_triplet[1:3] ## [1] "🐋 🏟️ 🌳" "🚇 🏰 🎡" "🏟️ 🎭 🥒" Then it’s a case of adding the emoji information into the grid_sf object, which can be done via st_df(). grid_sf_emo <- grid_sf %>% st_sf(ldn_emo_combo) %>% rename(., geometry = .) head(grid_sf_emo) ## Simple feature collection with 6 features and 1 field ## Geometry type: POLYGON ## Dimension: XY ## Bounding box: xmin: -0.1289476 ymin: 51.28676 xmax: 0.07882465 ymax: 51.29676 ## Geodetic CRS: WGS 84 ## emo_triplet geometry ## 1 🐋 🏟️ 🌳 POLYGON ((-0.123496 51.2868... ## 2 🚇 🏰 🎡 POLYGON ((-0.114679 51.2917... ## 3 🏟️ 🎭 🥒 POLYGON ((0.06512026 51.290... ## 4 🐦 🎡 🐋 POLYGON ((0.07882465 51.291... ## 5 🏟️ 🌳 🎭 POLYGON ((-0.1149681 51.291... ## 6 🏟️ 🏟️ 🏟️ POLYGON ((-0.1003241 51.296... You can see the triplets have been added as an extra column so there’s one triplet per grid cell. Time to create the interactive map with {leaflet}, which is built up in layers. I’ve added a light and a dark underlying map that you can toggle between6 I’ve also made the hexagons transparent with thin borders to it’s easier to see the map, but you can toggle the grid on and off to help pinpoint a location. leaflet() %>% addProviderTiles("CartoDB.Voyager", group = "Light") %>% addProviderTiles("CartoDB.DarkMatter", group = "Dark") %>% addPolygons( data = grid_sf_emo, group = "Grid", color = "grey", weight = 1, opacity = 0.5, fill = TRUE, fillOpacity = 0, label = paste(grid_sf_emo$emo_triplet),
labelOptions = labelOptions(
direction = "top", style = list("font-size" = "35px")
),
highlightOptions = highlightOptions(color = "blue", weight = 3,)
) %>%
baseGroups = c("Light", "Dark"),
overlayGroups = "Grid",
position = "topright",
options = layersControlOptions(collapsed = FALSE)
)

I found:

• Buckingham Palace at 🔔🐦🥒 (Big Ben, pigeon, gherkin)
• Leicester Square at 🌳🌳🏙️ (plane tree, plane tree, Canary Wharf)
• The Shard at 🐦🐋💂 (pigeon, whale, guard)
• Wimbledon at 💂🌳🏟 (guard, plane tree, Wembley)
• The Millennium Dome at 👸🚇🐉 (Queen, tube, dragon)

Literally minutes of fun. Of course, you shouldn’t use this map for anything whatsoever, possibly not even for your own amusement. I, on the other hand, can do whatever I like.

1. This post is not about that company or its practices. See instead, for example, the excellent YouTube videos by Andrew Steele and Mia Mulder, or Terence Eden’s blog post. Even the BBC covered it.↩︎

2. I was genuinely tricked by this website’s joke, fair play.↩︎

3. This blog is obviously a fan of emojis, see the one about creating SVG versions of the original emoji set or the one about a package for generating ‘emojiscapes’.↩︎

4. The seed value has a meaning related to London; guess what it is.↩︎

5. The file contains NUTS level 1, which is a European standard for administrative geographies. Now the UK has left the EU, it has technically switched to something called ‘International Territorial Units’ (ITU), which I think are the same boundaries as NUTS for the time being.↩︎

6. Darkmode required to prevent damage to poor Millennial eyes when doomscrolling at 0300.↩︎