-
Vector mapping!
4 hours ago • 0 commentsWith the rainy weather all weekend, I wanted to implement some graphical mapping features on the device. With an e-ink display on it's way (https://github.com/WeActStudio/WeActStudio.EpaperModule), all I have is the 0.96" OLED display I purchased from AliExpress. With a 1 bit display, there's not much to do for displaying graphics, especially for something as complex as location-based maps.
After implementing functions to render a pre-rendered bitmap tile, I opted to simplify it for the ESP32 and the display at hand. Using geoJSON data built from overpass-turbo.eu, I wrote simple map vector rendering. This can allow a user to upload any geoJSON file (under 80kb has worked so far without memory issues) and display their current location on the map. To reduce the complexity of the map, I used https://mapshaper.org/ to simplify the lines/polygons but it doesn't work with multilayer files. I was able to simplify using ogr2ogr:ogr2ogr -simplify 0.001 simplified.geojson input.geojson
This allowed me to....actually load the geoJSON data on the ESP32 with the RAM it has. Granted, I could use my ESP32-S3 (16MB flash/8MB RAM) but I prefer to work with constraints.I also added zoom functionality using the "nav" button, see the attached pics of it in use vs the original map. Also attached of the device in use I took a few weeks back, removing the first GPS coords screen (so y'all can't find me).