[OutSystems Maps] Auto-center map on large number of markers
outsystems-maps
Reactive icon
Forge component by Platform Maintenance
Application Type
Reactive

Looking to see if there is an easy way to have the map automatically pick the logical center of all my markers and do the initial render at that point. From what I can tell, the map will currently center on the first marker in the list. 

With 500+ markers on my map, there are times when there is a small cluster of a few markers that get rendered first while a larger cluster goes unseen as it is rendered outside the bounds of the initial view.

Solution

Hi @Nick P. 

The Map block has an input called Center where you can pass the coordinates you want, so you can do the Math on your markers position (Stackoverflow has several approaches using Google Maps APIs like this - not tested) and find the position you need the map to center, also based on the zoom level you might want.

Cheers,
GM

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.