Can anyone share some JavaScript that enumerates all markers in a Google Map?
Need script for v2 and v3 if possible. Thanks.
The only time you have access to the markers and can enumerate them is when they are created. The map has no awareness of what markers are attached to it, and it seems like you want to be able to do it on a map that has been initialised and markers have been added.
In other words, that is not possible. The way to do this is to put the markers into an array while you make them.
Related
Maybe someone knows if it's possible to get clustered markers list. Or to know if marker is inside cluster or not. The issue is currently each marker on my map have associated polyline as well. But when two or more markers gets clustered I want to hide polylines for those markers. Would it be possible somehow?
One way to implement this would be to add the markers to a h.map.Group() while rendering them and then you would be able to find if the marker is part of the group as well as the proximity of the two markers. Another way is to look at this marker clustering example to combine the markers if they are nearby.
I want to implement a map in flutter (can't use google maps) how can I do it? it's just a normal map with the ability to show current location constantly.
You can take a look on this package - https://pub.dev/packages/flutter_map
As a map tiles, you can use one of these https://wiki.openstreetmap.org/wiki/Tile_servers (but read open street maps terms of use https://www.openstreetmap.org/copyright).
If you want to display current location, you can use this package https://pub.dev/packages/location and you can simply add new marker on the map.
Hope this help!
Ok, let me preface this question with the fact that I have created a lot of google maps, but they have been strictly markers and polylines denoting routes and a couple with some handler interaction.
Now I am looking to show basically a map of the world, mostly North America and I want to split this continent into my predefined regions with some lats/lngs that I have. Using these regions I want to draw something like a polygon with a light opacity and different color per region.
I then want to use marker clustering but I want the clusters to be specific to these regions. I have looked around but I haven't found an example like this. I have seen pages that say you can do this but not how you would go about doing this. Again, I am definitely a noob when it comes to drawing polygons and using the marker cluster. I know this question is fairly vague but just looking for an example/idea to start off of, and more so I don't want to write a bunch of code against this specific api and then find out that it is not possible.
Any ideas or suggestions are greatly appreciated....Thanks.
It can be done, but will require a rewrite of the MarkerClusterer (probably will simplify it).
You will need to determine how you are going to represent and load the cluster boundary polygons (KML, GeoJSON, native Google Maps API v3 polygons) and probably use the google.maps.geometry.poly.containsLocation(point:LatLng, polygon:Polygon) instead of LatLngBounds.contains to determine which cluster "owns" a marker.
I am looking to map about 800 markers on a Google map. I have a csv file with addresses, including latitude and longitude coordinates. I would like to be able to somehow upload this file to Google Maps resulting in a map displaying all of my markers. This process will be automated, where a windows service (or via Sql Server Integration Services) will upload the address data to some url, effectively updating the markers on a map, which is embeded on an Asp.Net page on my site.
Does anyone know of a simple way this can be accomplished? Are there any tools out there that can already do this? I've looked at batchgeo.com and there file upload feature, but I don't think their tool can be automated.
Why not just to use google maps api v3 to display the markers? With 800 markers you probably would like to use marker clustering e.g. using markerclusterer
800 markers is a lot for one map, especially without marker clustering. Do you think maybe something like Google Fusion Tables would work? It's pretty easy, doesn't require much in terms of coding, and I'm fairly certain you can update records via URLs. You can upload your initial CSV file to it, too, and then display the points on a Google Map.
I'm building a google maps web site with markers placed onto the map. Some times the markers overlap so I want to be able to interactively bring to the front specific markers.
I can use setZIndex() for this. But I need to know the initial max zindex of all the markers. getZIndex() is no use as it doesnt seem to return anything unless youve already called setZIndex().
It would be tempting to say "just start with a very big number" but I believe Google uses latitude or something to calculate the initial zIndex so the maximum zindex may vary? Making this scheme risky.
Does anyone know what the max initial zIndex will be for N markers in Google Maps V3?
You can use the constant MAX_ZINDEX to ensure that the marker will display on top.
marker.setZIndex(google.maps.Marker.MAX_ZINDEX + 1);
Search the reference of the constant in the Google Maps API V3 Documentation