Google Map API – Removing Markers

You need to keep an array of the google.maps.Marker objects to hide (or remove or run other operations on them). In the global scope: var gmarkers = []; Then push the markers on that array as you create them: var marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i].latitude, locations[i].longitude), title: locations[i].title, icon: icon, map:map }); // … Read more

How to use SVG markers in Google Maps API v3

You can render your icon using the SVG Path notation. See Google documentation for more information. Here is a basic example: var icon = { path: “M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0”, fillColor: ‘#FF0000’, fillOpacity: .6, anchor: new google.maps.Point(0,0), strokeWeight: 0, scale: 1 } var marker = new google.maps.Marker({ position: event.latLng, map: map, draggable: … Read more

Google Maps API: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

https://maps.googleapis.com/maps/api doesn’t support getting requests from frontend JavaScript running in web apps in the way your code is trying to use it. Instead you must use the supported Google Maps JavaScript API, the client-side code for which is different from what you’re trying. A sample for the Distance Matrix service looks more like: <script> var … Read more

Google Maps Api v3 – find nearest markers

First you have to add the eventlistener google.maps.event.addListener(map, ‘click’, find_closest_marker); Then create a function that loops through the array of markers and uses the haversine formula to calculate the distance of each marker from the click. function rad(x) {return x*Math.PI/180;} function find_closest_marker( event ) { var lat = event.latLng.lat(); var lng = event.latLng.lng(); var R … Read more

Draw path between two points using Google Maps Android API v2

First of all we will get source and destination points between which we have to draw route. Then we will pass these attribute to below function. public String makeURL (double sourcelat, double sourcelog, double destlat, double destlog ){ StringBuilder urlString = new StringBuilder(); urlString.append(“http://maps.googleapis.com/maps/api/directions/json”); urlString.append(“?origin=”);// from urlString.append(Double.toString(sourcelat)); urlString.append(“,”); urlString.append(Double.toString( sourcelog)); urlString.append(“&destination=”);// to urlString.append(Double.toString( destlat)); urlString.append(“,”); … Read more

Is it illegal to not using Google Static Map trademark? [closed]

As per the Google Map Terms and Conditions section 8.4 b viii Restrictions. In using Google Brand Features, you will not: remove, distort, or alter any element of a Google Brand Feature (including squeezing, stretching, inverting, or discoloring). and section 8.5 Proprietary Rights Notices. You will not remove, obscure, or alter any proprietary rights notices … Read more