Display multiple markers

Hi,
I have about 10,000 markers to be displayed on the map. I am currently using a png as the marker icon.
However when the map is loaded and i proceed to add the markers it gives a out of memory error while adding the icons.
Could someone help out as to what image formats are supported for changing the icons on a marker?
Also is there any way to change the color of the default marker provided by the sdk?
regards,
Nigel.

Hello,

There are no hardcoded restrictions regarding image format you can use apart from those which came directly from Android regarding Drawable (png, jpg, gif):
https://developer.android.com/guide/topics/resources/drawable-resource

Apart from the format itself, currently adding markers functionality is rather heavy and it might be difficult to show so many markers at the same time on the map. You can try to enable clustering:

It is possible to change the icon of the Marker. It was not possible few SDK versions ago but it is possible with the latest one for sure. It can be achieved with MarkerSettings class and it’s method ‘updateMarkerIcon’. MarkerSettings can be obtained from TomtomMap instance.

Actually, it is not so easy to change the colour of the Default Marker via API. But you can provide your own default marker icon by placing them under res directory with names:

  • ic_markedlocation.png
  • ic_favourites.png
    Then it will override default icons provided by SDK.

Regards,
Ryszard

2 Likes

Hi Ryszard,
Thank you for your reply.
I have already enabled clustering so it does give a good performance gain.
The thing is the default API marker gets displayed very well. I wanted to know what are the dimensions of that default image so that I can replicate the same for my other marker png images?
Regards,
Nigel.

I was making a mistake while creating the icon using Icon.Factory.
So ideally I had to first create the icon and then in the iterator simple pass a reference of it.