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

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))); }

Display toolbar for Google Maps marker automatically

The overlay that appears when a marker is clicked, is created and destroyed on-the-spot implicitly. You can’t manually show that (yet). If you must have this functionality, you can create an overlay over your map with 2 ImageViews, and call appropriate intents when they’re clicked: // Directions Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse( “http://maps.google.com/maps?saddr=51.5, 0.125&daddr=51.5, … 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

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

Using Icon Fonts as Markers in Google Maps V3

I just had the same problem – decided to do a quick and dirty conversion and host on github. https://github.com/nathan-muir/fontawesome-markers You can manually include the JS file, or use npm install fontawesome-markers or bower install fontawesome-markers. Just include the javascript file fontawesome-markers.min.js and you can use them like so: new google.maps.Marker({ map: map, icon: { … Read more

Resize Google Maps marker icon image

If the original size is 100 x 100 and you want to scale it to 50 x 50, use scaledSize instead of Size. const icon = { url: “../res/sit_marron.png”, // url scaledSize: new google.maps.Size(50, 50), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 0) // anchor }; const marker = new google.maps.Marker({ … Read more