Animating Multiple Markers

If you want to animate multiple markers you will have to change the animate and startAnimation functions to handle multiple markers (probably make all the variables into arrays). example code snippet: var map; var directionDisplay; var directionsService; var stepDisplay; var position; var marker = []; var polyline = []; var poly2 = []; var poly … Read more

Android Maps Utils Clustering show InfoWindow

Here is a simplified and slightly modified solution based on this answer. Note that the linked answer implements an InfoWindow for both Markers and Clusters. This solution only implements InfoWindows for Markers. It’s similar to how you would implement a custom InfoWindowAdapter for normal Markers with no Clustering, but with the additional requirement that you … Read more

How to get screen coordinates from marker in google maps v2 android

Yes, use Projection class. More specifically: Get Projection of the map: Projection projection = map.getProjection(); Get location of your marker: LatLng markerLocation = marker.getPosition(); Pass location to the Projection.toScreenLocation() method: Point screenPosition = projection.toScreenLocation(markerLocation); That’s all. Now screenPosition will contain the position of the marker relative to the top-left corner of the whole Map container … Read more

Adding multiple markers in Google Maps API v2 Android

ArrayList<MarkerData> markersArray = new ArrayList<MarkerData>(); for(int i = 0 ; i < markersArray.size() ; i++) { createMarker(markersArray.get(i).getLatitude(), markersArray.get(i).getLongitude(), markersArray.get(i).getTitle(), markersArray.get(i).getSnippet(), markersArray.get(i).getIconResID()); } protected Marker createMarker(double latitude, double longitude, String title, String snippet, int iconResID) { return googleMap.addMarker(new MarkerOptions() .position(new LatLng(latitude, longitude)) .anchor(0.5f, 0.5f) .title(title) .snippet(snippet) .icon(BitmapDescriptorFactory.fromResource(iconResID))); }

Change marker size in Google maps V3

This answer expounds on John Black’s helpful answer, so I will repeat some of his answer content in my answer. The easiest way to resize a marker seems to be leaving argument 2, 3, and 4 null and scaling the size in argument 5. var pinIcon = new google.maps.MarkerImage( “http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FFFF00”, null, /* size is determined … Read more

Google Maps API – Closest marker function change to closest n markers

You could use the (slightly modified) findClosestN function from this question (changed gmarkers to markers, changed the function to return the closest array limited to numberOfResults elements) function findClosestN(pt, numberOfResults) { var closest = []; for (var i = 0; i < markers.length; i++) { markers[i].distance = google.maps.geometry.spherical.computeDistanceBetween(pt, markers[i].getPosition()); markers[i].setMap(null); closest.push(markers[i]); } closest.sort(sortByDist); return closest.splice(0,numberOfResults); … Read more

How to get the formatted address from a dragged marker in Google Version Maps

You need to use the reverse geocoding service (as demonstrated in the example you link to) to retrieve the formatted address. This code from that example calls the reverse geocoder and uses the response to display the formatted_address that is returned by it: function geocodePosition(pos) { geocoder.geocode({ latLng: pos }, function(responses) { if (responses && … Read more