You should iterate through the array to check for the marker for (var i=0; i.
You should iterate through the array to check for the marker. For (var i=0; i.
Rob, so if I have, say, a 1000 markers on the map and I'm panning the map just a little bit so all the markers should still appear, and I've been told not to remove and add again markers but to check first if they're already there, so that would mean that for each of the 1000 markers I will have to averagely go through half of the array. That could lead to 500,000 checks, in worst case scenario. Wouldn't it be less consuming to just remove all 1000 markers and then add them back?
– Ash Jun 1 at 7:20 1 I doubt it would be better to remove and add them back, as there is a fair amount of overhead to that process. One option, if you have a performance problem, would be to store your markers separately in a lookup table, so you don't actually have to iterate. If you have any unique identifier on each marker, you can use that as the member name in an object.
There are various other means you could use to keep track of them, since you are presumably creating, adding and remove these markers yourself. – rob Jun 1 at 7:32 @Ash: do you add markers to the visible region and hide those that are in the invisible region when the map is panned? – Salman A Jun 1 at 7:50 @rob, thanks a lot.
– Ash Jun 1 at 8:02 @Salman A, no. When the map has finished panning or zooming (idle event) I get the lat,lng of the viewport's bounds and with an ajax call I get from the db only the coordinates which are in this viewport's bounds. – Ash Jun 1 at 8:04.
First, (marker in markersArray) is wrong since in doesn't look for elements in the array. It looks for properties. The way it worked for me was for (var i=0; iLength; i++) { if (markersArrayi.getPosition().
Equals(marker.getPosition())) { ... This works as long as what you need compared is only the coordinates of the markers. We use here the LatLng class' . Equals operator.
I'm not sure I can use it in my case since I have to create an instance of marker to be able to compare it but if I create it than that instance can't really be in the array. I think I have to use the === operator. – Ash Jun 1 at 8:15.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.