Google maps markers are hidden behind each other - google-maps

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?

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

is this any use to you - it's called 'Spiderfier':
http://blog.mackerron.com/2011/06/22/overlapping-marker-spiderfier/
https://github.com/jawj/OverlappingMarkerSpiderfier

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.

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

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.

Related

Create tiles given images and locations; convert markers to tiles

I've developed a HTML application that displays a map. This map has many fixed markers (they do not change in time).
Due to that:
I want to speed up the application
I want to hide the marker position from malicious users (so they can't use the information I've gathered for they're own porpose)
I want to convert the markers to a tile layer.
I've been googleing without success how to do this. Anyone has faced this problem and has a nice easy solution?
Thanks!
If the markers never change, there is a great solution:
Mapbox.
You can create your map with the markers, then the mapbox servors will send the tiles with the markers.
You can use a quadkey. It'similar to a quadtree. You can download my PHP class hilbert-curve # phpclasses.org. It also uses a quadkey.

Custom layer/overlay in google maps

Is it possible to create custom layers/overlays in google maps?
As an example, would it be possible to have one layer with polygons, another with circles, and a third with markers? and then hide/show these layers individually?
I tried looking at the documentation, but the layers seems to only be a fixed set of predefined layers. And overlays seems to only support image overlays.
Any help on this is appreciated.
I'm not sure if there exists a better way to do this, but I've found a workaround to a similar problem. My example utilizes markers and polylines, but it should be easy to extend the functionality to circles and polygons too.
Link to JSFiddle
Basically it works like this:
Initialize the map.
User selects an option what he would like to see on the map.
Click triggers a method (see HTML part of the fiddle) in the map object that first clears the map and then pushes new overlays on map.
The data that is currently shown on map is stored in arrays, and the map clearing method simply goes through these arrays and checks if there exists any content on map, and removes them if does.
Hope this helps. Cheers!

How to make markers larger in google street view

I was wondering how/if it was possible to make marker icons appear larger than the default in google maps street view. (they currently show up really small/hard to see.)
Thanks.
You need to use a larger icon (pixel-wise) and also set the size of the icon and/or scaledSize via the MarkerImage class.
Here is a quick and dirty example:
http://jsfiddle.net/AdnGH/
Here is the relevant documentation:
http://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerImage

Google Maps API (static) - custom marker not showing up

URL:
http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:http://tinyurl.com/2ftvtt6&zoom=12&size=400x400&sensor=false
I have no clue what I'm doing wrong here.
Developer Guide:
API - Custom Icons
...markers=icon:url[stop]&zoom=...
It seems that you defined marker style, but didn't define marker location. It should be:
http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:http://tinyurl.com/2ftvtt6|40.714728,-73.998672&zoom=12&size=400x400&sensor=false
I had some problems with the markers, too.
Maybe these hints help other guys
Marker should be max 64x64 pixels in size
long marker filenames can cause issues
always define a marker location - see accepted answer
Another point I wanted to add for future reference. Don't use svg files. They won't be rendered in the final map image.

Google Maps Creating two markers and a line between them

I am wondering how I can create two markers on a google map (upon click) and have a line drawn between them. Ideally both markers would be draggable after they are initially dropped and the line would readjust accordingly.
Maybe you can check this example, though is already deprecated it might help you to get an idea
http://maps.forum.nu/gm_flight_path.html