Bounds and markerstyling in MapView

Hi!

I’m using your MapView in my application. Right now it has about 1000 markers, and at time it will have between 5000 and 6000 markers which leads to a somewhat noticeble performance drop.

On the web this is an easy fix, as it’s just to use MarkerClusterer.

And I think I have an idea about how to do this in Fuse. But to do this I need to know the bounds of the view, or rather what area is shown in the view. It’d be great if this is something you guys could put into the native map.

This would also require some sort of special styling of the markers. The coolest would of course to be able to use Fuse, but at the very least I need to have the ability to change the icon and have a dynamic text on it.

Ref this forum post, it seems like the ability to style markers might be relevant for others too.

I think the solution for all your uses will be to allow foreign code to extend the native MapView so you can have your way with it any way you want. Getting those hooks in place is infinitely preferable to doing a series of custom fixes for each use case. MarkerClusterer for instance is a GoogleMaps thing (as far as I can tell), Maps on iOS is Apple Maps, and markers don’t behave identically there.

I both agree and disagree here. At the low-level this is most certainly a per-platform case.

But at least custom markers will be a necessity for pretty anyone using maps to some extents. But I guess foreign code with good hooks is an okey solution as long as there’s a good example to get people going.

You are correct that MarkerClusterer is a Google-thing, but it’s just a script that uses the functionality of Google Maps. It basicly replaces all the markers in an area with one giving graphical response to what’s actually there. As far as I can see, a fuse-version of MarkerClusterer could be solved with pure JS as long as I actually can know what area is shown in the map (bounds). I guess it is possible to do already, but that would be a per-platform case with fairly complex maths as far as I can tell. In my eyes this would be a really neat addition to the MapView as the bounds of a map has a lot of usecases.

Getting the map bounds in lat/long is definitely doable and it’s info worth exposing, so I’ve added an issue for it. It’ll be interesting to see how this works out for your particular use case.

Hello Master Andreas Rønning!

First of all, thank you soo much for your great work. Actually, your native-map implementation is the MAIN reason, why I start using fuse in the first place :slight_smile:

I think both feautures, “custom marker icons” and “clustering”, will fill a big need for all users playing with the MapView.

Gratefully

Blade

Andreas Rønning wrote:

Getting the map bounds in lat/long is definitely doable and it’s info worth exposing, so I’ve added an issue for it. It’ll be interesting to see how this works out for your particular use case.

Great stuff! Will you update this thread when it’s released so I know when I can try it out? As far as I’ve read from the MarkerCluster-code it seems that Bounds is only the actual thing called from the Google Maps API. The rest is pure javascript without mumbo-jumbo :slight_smile:

Regarding the custom markers. Could it be as “easy” as allowing to draw shapes like Rectangle on top of the map, but you guys doing some translation from coords to pixels in the back?

If not, I guess hooks for doing it via native code would be a good enough solution, even though I would argue a Fuse-method would be the ultimate here. I am quite sure this will be a topic later on if the method for doing this isn’t easy enough.

Though, for starters native code hooks will suffice for mapping the need for this functionality in fuse.

Hi!

I see there’s a new version in the experimental channel. Is bounds implemented in this version, or will it be in a later one? If so, how much later? :slight_smile:

Bump

Any news on this?

I see you’ve implemented custom icons in the pre-release channel. Is there any news on the bounds? An update on this would be really great.

> **Andreas Rønning wrote:** > >

Getting the map bounds in lat/long is definitely doable and it’s info worth exposing, so I’ve added an issue for it. It’ll be interesting to see how this works out for your particular use case.

> Any update on this? Sounds like you’ve done the hard part with fixing the icons. It’s been quite a while now and it would be really great with bounds too so I could start the development again :slight_smile: