LogoThe Journey to Map Maker (aka The Coronavirus Diaries)

My current WIP in the Biscuits Project (Garibaldi) is now at parity with my previous iteration on the things I care about: being able to segment a map based on the structure of its streets. Except that it is all now being done client-side.

It's not obvious it's doing anything special as I deliberately just put them back in their original locations. Being able to take something to bits and put it back together again is a key ability! However, it's not very interesting to look at.

Hence Map Mixer. The core idea is to see what a Map of a city looks like if I swap over similar-size blocks from another city. I don't know what this will look like, so time to explore.

My general strategy for personal projects is similar to the Double Diamond approach. The above is me doing "building the right thing" i.e. what am I gonna build next? What comes next is actually building it.

Doing this seems to break down into these steps:

  • take two pre-segmented Maps
  • analyse segments by similarity in each Map
  • take destination Map and lay it out
  • take source Map and find segments in destination Map that most closely match destination
  • replace segments in destination with source segments (do repeated fill if more segments in destination than source)
  • allow it to re-layout
  • solidify and re-draw i.e. turn it back into a Map with streets

Next, I will try to see what I already have that can fit these needs, perhaps doing some re-factoring / clean-up to get there. I will also do various spikes on different technologies or approaches that fill the gaps. Then I will incrementally start re-integrating these learnings back into the main app, trying out examples as I go. Finally, I will apply iteratative optimisations on the code as I use it, where it seems sluggish.

First spike: Layout. I am assuming that laying out the Map will not be as simple as drawing a Map because bits from each Map won't fit together cleanly. So, some "jiggling around" will be required. To make it look like a real Map, some constraints need to be followed, such as not having overlapping segments. An idea here is to use some sort of physics engine that can apply these constraints.

I've been doing a lot of Rust recently; the small segmenting core of https://garibaldi.houseofmoran.io/ is built in it. So, my first choice for layout it out was seeing what was available in Rust. Specifically, nphysics2d for doing the layout.

Unfortunately, I had some issues getting nphysics to compile under wasm, using wasm-binding. I don't think it's a dead-end, but I realised for the sake of experimentation, it may be simple to use an old-favourite of mine: d3-force layout. So, stay tuned on that.