established 10 years ago

I haven't written anything here in ages upon ages. For some reason, probably fading illness, I'm feeling verbose tonight. 

For this crazy adventure travel planning/tracking platform and app I've been working on for ages, I use MapLibre for the basemaps. It's a fork of the last open source version of Mapbox before they heinously decided to change their license to something that wasn't workable.

I had pondered maintaining a fork of the last version of Mapbox myself, since without it my project would be dead, but I wasn't looking forward to it since it would be a ton of additional work.

I noticed a small group stepped up, forked it, and created the Maplibre project. I didn't hold out much hope because such open source efforts rarely succeed.

But I have to admit, I have been so pleasantly surprised, actually no, impressed beyond words, at how professionally well managed that project is by it's maintainers. These are some serious people and I could learn a lot from them.

I am grateful. It means it's one less project I have to maintain, and frankly with all the support they've gotten they're doing a level of work I wouldn't be able to touch.

But, because I'm using Ionic/Angular/Typescript (i.e. Javascript) I have to use the web browser based API ... which does not have any support for offline use.

For my project, it's a 100% requirement that the basemaps be downloaded to the phone, along with all other assets, images, data, whatnot and be completely usable off-grid.

Back with their 1.15 version, before they made major changes to the original Mapbox codebase, there was no offline solution, so I grabbed an old proof of concept another developer had released, and with a ton of work created my own "patch" that enables my hybrid phone app to pull base map tiles and assets from the local phone.

And it's worked like a champ ever since.

Unfortunately, Maplibre has moved on and radically changed things for the better meaning that the amount of effort it was going to take to update my "patch" to work with the latest version of Maplibre was going to be non-trivial. The additional downside is that I would have to continue to update this complicated patch every time they come up with a new version to keep in sync. No fun.

I was really hoping to avoid this until later this year, but one of my immediate core requirements is to be able to resize photos on the phone and store them while offline. As it stands right now, when you're off grid and you add some photo to the map, I can't create a high quality thumbnail for stupid technical reasons, so I put a black 'no photo' marker on the map and wait until the user gets back on grid, uploads their trip. I then resize the images, and send the thumbnails back down. Stupid.

However, I decided to bite the bullet and solve that problem and after a few hours of scouring, I found what looks to be a high quality in browser image resizer that doesn't generate pixelated images. Awesome.

Then came the bad news. It relies on an API called FileReader. Ok. It's standard API that every browser support but I couldn't for the life of me figure out why it was crashing with 'no such method' errors inside this apparently high quality solution.

Hours of digging and on the verge of punting for a lesser quality solution I came across a github issue where one of the plugins I rely on for the "patch" mentioned above, overrides the FileReader API ... and does so incorrectly.

(Seriously, if you're going to be override the FileReader API, you could at least do it correctly.)

As it is all those plugins that my patch rely on are legacy and unmaintained at this point, so they all need to go.

Time to bite the bullet.

And then I got stupid sick.

Aaron's bicycle trip is in two weeks. I have been working to get a new build put together for him for that trip that would address all the issues we uncovered during the camping trip several weeks ago. But it's been a huge effort. 40 issues total. 20 issues done. 20 to go.

Then this.

I had noticed some time ago that the Maplibre folks had added an API where one could add custom map tile handlers in a clean way. If I could get that to work it would mean I would no longer have to maintain my own offline base map patch and I could just keep up with whatever their release schedule was without hopefully too much issue. (Famous last words as i just spent half a week upgrading another component, Ionic from Ionic 6 to 7.)

But I only have two weeks. I was not at all convinced I'd be able to get a new offline solution developed and working with their new API, it's just a hook after all, in anything under a week. 

But as of as long ago as I've been writing, I actually have a first working version of Maplibre 3.1 with an updated offline map tiles solution that seems to work like a champ. 

It only took about 18 hours. 

18 hours to make three weeks or so of work from ages ago completely obsolete. 

But that's how it goes. 

It's working on Android. Tomorrow i'll get it working iOS, fingers crossed. and then it's back to client side photo resizing and the other 19 items on my list. 

You must be a member of this group to post comments.

Please see the top of the page to join.

Link Details