So, I have a lot of thoughts. I’ve kept them to myself for a long time. I figured, “no one cares, no one reads these things”. But then I thought, “no one cares, no one reads these things” so I decided to start to post. If I comment on your thread, I’m sorry. ✨
Bare with me, X for some reason tagged this as spam, & on mobile
Custom, so I'm starting with GeoJSON. Here I get the features, labels & POIs data & it gets fed to the download & conversion program.
The converter reads each GeoJSON features & classifies it by examining the OSM tags. Off the top of my head, the highway tag for example (highway=residential) becomes FEAT_ROAD (0), (etc).
This reduces the tag data down to a single byte, and the only thing the renderer actually needs to know is 'what colour is this'.
The raw coordinates are floating point lat/longs, so I normalise it all into a 16-bit integer grid relative to the imported bounding box in the download & conversion stages. This maps the whole map area into a 16348x16348 virtual space, and each coordinate only takes 2 bytes (int16) instead of 8 bytes (float64).
Then, I use Douglas-Peucker line simplification - I believe thats probs the key part here, hard to explain here in this format but ill have a go (bare with) with an example
1. Take a road/rail/line from start to end
2. Find the point furthest from this line
3. If that distance < epsilon (threshold i use is 0.00005° (≈5m)) replace whole segment with start>end
4. If it exceeds epsilon, split at that point and recurse on both halfs
After scaling to int16, some points (adjacent) end up at the same pixel. To fix this, I deduplicate consecutive identical points.
Then there's spatial tiling, the 16348x16348 space is divided into an NxN grid (i tend to use 4x4), each feature gets assigned to every tile its bounding box touches, which means any road etc from adjacent tiles will still exist etc - still self contained though.
Each tile, as a row_column format is output as a packed binary, so no parsing, and reads directly as raw bytes.
For processing on device, and rendering, it uses Bresenhams line algorithm, integer only no floating point. For zoom, it calculates a sub-region of the tiles coordinate space and scales only the visible portion to fill the screen. Labels and points are drawn last on top.
In my max stress test, chrome failed to render this on a modern PC in a browser but this device rendered over 8,500 OSM features with relative ease using these methods
@azuk4r And if I’m being 100% honest, I really, really wanna go back to Linux, but having native windows allows me to also have an easy environment to practice with my BadKB scripts. Also games.
@azuk4r Honestly, I couldn’t get windows to work on gnome boxes or virtual box. And when I could get it to work, I couldn’t get usb pass through to work. I was so frustrated I said fuck it and switched back to windows.
@wolfyaltwitch@femmefemmefatal That is fucking IT. Thats the last straw. If that could get published, if that can get printed onto actual paper and sold in a bookstore, I have no reason to not write my own book. Fuck.