Geographical sorting is not a thing
16 August, 2020
You know the drill: happily traipsing through a webform like you've done this a thousand times. You fill out your name (nailed it). You type in your phone number (
0000000000, I know, what are the chances?). You only type in the first letter of your email, and your browser does the rest. Today is a good day, you think.
But something's wrong. The slightest frown crawls over your face. You feel the hairs on the back of your neck start to rise. You scroll down with trepidation. Yes — you knew it was coming. A dropdown menu.
Beads of sweat start rolling down your forehead. Thoughts race through your mind. It can't be. This is 2020. They care about us. They wouldn't do this to us! Your mouse moves slowly, agonisingly closer to the menu. It hovers over the field. Your hand is shaking. You take a deep breath, say a silent prayer, and click.
The dropdown menu, er, drops down.
It's geographically sorted.
I haven't a clue why anybody would think this is a good idea. Filling out a webform should not be a geography lesson. There is no conceivable situation in which a person doesn't know the name of the thing they are looking for, but somehow does know the names of the two things directly north and south of it.
"Oh yeah nah, I actually have no idea what that big city is called, you know, where like half of the country lives, but, er, it's definitely south of Whangarei but above Hamilton?"
In the spirit of togetherness, I decided to come up with a few alternatives to simple north–south geographical sorting, in the hope of giving developers a few more options with which to ruin their users' experience. To do this, I made a Shiny app because it's the easiest way I know of to create a bunch of dropdown menus programatically.
Because I'm lazy and would rather spend twenty minutes figuring out how to automate something that would take me two minutes to type out, I'm using the R package rvest to scrape a table from a Wikipedia page that contains the names and populations of a bunch of urban areas in Aotearoa. I'm then using the Google Maps API and the R package ggmap to get the latitude and longitude coordinates of those cities. I have a tutorial that covers setting up the Google Maps API for use with ggmap that you can find here.
We fight back against the tyranny of the northern hemisphere with this one simple trick: south to north ordering. Invercargill is the new Auckland.
Equal opportunity coordinates
Why should north and south get all the glory? We all know that it's Never Eat Soggy Weetbix, not Never Soggy (although the latter is certainly something I could get behind). Here we sort by west to east. In a happy coincidence, Invercargill rules the day again!
He aha te mea nui o te ao?
He tāngata, he tāngata, he tāngata.
Translation: what's the most important thing in the world? It is people, it is people, it is people. Here, we sort by population.
Why not, though?
In these modern times, we shouldn't be putting overdue emphasis on clearly arbitrary attributes, such as the first letter of a name. The third letter is just as important, and don't let anybody tell you different.
Okay, but really
Please sort your dropdown menus alphabetically <3
You can find the full code to reproduce these dropdown menus on my Github, here.