Steven
Steven

Reputation: 19425

Google maps markers are hidden behind each other

I have a problem with markers hidden behind other markers.
The problem occurs when the addresses are too close to each other. e.g. street 20, street 22.

Changing zIndex will not help, because that is just "stacking".
How can I "float" the markers so that they are all visible on the map?

Upvotes: 3

Views: 4719

Answers (5)

herostwist
herostwist

Reputation: 3958

I recommend you look into marker clustering.

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/advanced_example.html

UPDATE:

Google now support marker cluserting via a native library: https://developers.google.com/maps/documentation/javascript/marker-clustering

Upvotes: 2

seyhan
seyhan

Reputation: 785

I use marker clusterer and had the same problem. I add a small random number to coordinates. I do not want to change the locations of markers so much therefore in satellite mode problem still exists but in map mode we can zoom much more. This may not be a good solution but good enough for my application.

Upvotes: 0

Argiropoulos Stavros
Argiropoulos Stavros

Reputation: 9533

So,you can use mysql spatial extensions and MBRContains(RectangleAroundYourPoint,GeometryColumnOfYourTable)

-if of course your table have a geometry column which is easy(upon creation you choose i.e. point as the column type,and when performing an insertion you have to do it with GeomFromText)-

to check if another place exist within that rectangle and if it is move the newcoming place until the mbrcontains return false or something like that.

Hope it helps

Upvotes: 0

Carolyn
Carolyn

Reputation: 101

It might help to use smaller markers. When I had this problem, I changed the size of my marker images from 20x34 px down to 20x20 px.

Upvotes: 0

Related Questions