ultimate-geography icon indicating copy to clipboard operation
ultimate-geography copied to clipboard

Visual representation of capitals

Open cburroughs opened this issue 4 years ago • 4 comments

I offer this more as a discussion topic rather than something I'm sure is a good idea, but with v4 on the horizon it felt like the appropriate time.

Aside from tiny islands in need of a zoom box (generally already covered by tickets, and greatly improved over the past year!) I find that Capital-->Country tends to be where I struggle the most. I suspect this is because my brain doesn't have anything visual to latch (flags, maps) onto, so it turns into a rote "what does this name I may struggle to pronounce point to". Sometime I can go back and try to come up with my own mnemonics, or read the wikipedia article on the capital and hope that gives me some context to latch on to. Both of those go one at a time and I tend to only realize I need to do it once I have a leech on my hands.

From doing this I noticed that in most (all?) cases the wikipedia article for capitals has a map of where the capital is within the country. I wonder if would be sensible and (relatively) low effort to include that map as a field and use it for additional context. So concretely the card for Country-->Capital would be Country-->Capital,CapitalMap. I know this is somewhat inconsistent with how the rest of the fields are used, but I wanted to offer my experience as a learner before all my Ultimate Geography cards are mature (I hope soon!).

cburroughs avatar Jul 01 '20 01:07 cburroughs

I totally agree with you and would wish that such maps could be included.

The way how wikipedia does this is by adding a pin via some extra markup to a map. A while ago I was wondering if Anki would support something like that as well? (But I wasn't familiar enough with how Anki works to achieve that) If possible that would enable Ultimate Geography to just add some relative coordinates to add a pin as an overly onto the current maps. In that way the size of the deck wouldn't increase too much (since I remember that being a concern in the past)

Erim24 avatar Apr 16 '21 13:04 Erim24

Anki's "cards" are embedded HTML pages usually scriptable with JavaScript, almost exactly like normal web pages.

Anki desktop, Ankidroid and Ankimobile (iOS) all definitely have JS support. There are slight differences, but it's not much worse than the diversity among web browsers. I'm not sure about Ankiweb — I haven't tested and there might be security concerns regarding AnkiWeb allowing what is effectively third-party JS running on their pages.

Hence, something like Wikipedia's approach should be doable.

The main issue is that the "panning" of our (AUG) maps differs from map to map, and isn't known for the vast majority of them.

For each map we know the projection (Winkel Tripel with the standard value of φ_1, always(?)) and the central longitude (usually 0°, 11°30' East or 150 ° East), but we don't know how the map was panned or zoomed (we're not displaying the entire globe). I'm not sure how easy it'd be to extract this information from the SVGs. (I've been thinking about this for a while — it'd be also useful for #267 — and have some ideas, but I haven't tried anything yet — too many things to do, and too little time...)

If this information were obtained, then displaying a pin should be relatively straightforward. (In order to calculate the position of the pin on the map AFAICT we just need:

  1. the longitude of the capital,
  2. the latitude of the capital,
  3. the central longitude for the W3 projection
  4. the "x" panning of the map
  5. the "y" panning of the map
  6. the zoom level of the map

This position information could be stored as a list of numbers in an extra field. We could also have some JS in the relevant template that'd process this info and display a pin on top of the map, just like Wikipedia.)


If we don't want a JS-solution, for whatever reason, we could generate SVG overlays for each of the capitals. These would just be SVG "pins" in the correct positions, in transparent canvases. They could be applied to our existing maps via CSS filters.

Since such SVG overlays would be extremely lightweight, we wouldn't add much to the size of the deck.

(Obviously, we'd still need to solve the panning/zoom information problem.)


OTOH if we make the maps with pinned capitals optional, then having hardcoded images wouldn't be too much of a problem. It'd have the advantage that we could use Wikipedia's "pin" maps, which have known panning/zoom level. It'd have the disadvantage that the "style" of these maps wouldn't fit the style of our existing AUG maps.


We could also look at what the Anki UK geography deck does — they seem to have pins for cities!

aplaice avatar Apr 16 '21 15:04 aplaice

I have used the following code to have a map for each capital:

Adjusting the "z=" part can make the map more zoomed in or out.

I also put a Wikipedia page within the card with this:

End result looks like this: Screenshot 2023-04-24 at 3 05 49 PM

drake-macmillan avatar Apr 24 '23 20:04 drake-macmillan

Hence, something like Wikipedia's approach should be doable.

If I understand anything at all, the HTML for displaying map and pin on Wikipedia is generated from this lua script: Module:Location map. It can also fetch a map file based on what location name you enter.

melissis avatar Feb 22 '24 20:02 melissis