ComposeMap – Sticky Circle

poster

Welcome back!

Previous article introduced library ComposeMap I’m working on.

Today I’m going to show you a demonstration of my most recent work.

Demo

Comparing this demo to the latest one, one circle is added.
The second circle on the right is also controlled by the slider. But the big addition is that it can be moved around by using drag gestures. 

The circle example might seem too simple, but I wanted to focus on verifying whether all the features for my MVP can be implemented. Adding a drag gesture to points on a LineString or using a symbol feature is just a matter of time and for the purpose of exploring the interaction with the native maps from compose is not required.

Having said that I was also careful when designing the API for drag gestures. I’m trying to keep everything compose-way – guidelines.

Sample code

Library availability

As many of you were asking me when the library will be available I want to answer that, but I can’t. Even if the demos look good this is a work in progress, there are still many rough edges I like to polish before releasing the library. 

If you are willing to be among first to test the library, let me know.

Implementation note on annotations

There was a structural difference between iOS and Android implementation of annotations. Since this project is really about using Compose to control the map and not just a wrapper around native maplibre, I decided to use drag handlers that are already available in compose. It relieved my headaches of wrapping the annotations of all the different platforms. And with that the need to maintain that in future is also gone. 

It means the annotations will by handled on compose multiplatform rather than the native level. It will make extension of the library to other platforms much easier to do.

Conclusion

I realised it is possible to interact with the map features using native compose drag modifier. However the way the annotations were implemented isn’t that efficient since it creates one layer and one source per annotation. Annotations implemented in maplibre-plugins-android also face this issue. However adding a bigger amount of points on the map would create way too many layers and sources in my opinion. A different approach must be explored – at least for non-interactive features.
Anyway, see you next time!


Stay up to date to these developments!

I will be posting some progress of my journey.


Connect

If you have some questions, suggestions, requests or want to test out this library yourself, get in touch with me using the contact form.

Get in touch