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

How to disable Google Map’s Satellite view?

var myOptions = { zoom: 2, center: **Your LatLng object**, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID] }, // hereĀ“s the array of controls disableDefaultUI: true, // a way to quickly hide all controls mapTypeControl: true, scaleControl: true, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE }, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById(“map_canvas”), myOptions); // displays in <article … 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: how to get country, state/province/region, city given a lat/long value?

What you are looking for is called reverse geocoding. Google provides a server-side reverse geocoding service through the Google Geocoding API, which you should be able to use for your project. This is how a response to the following request would look like: http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false Response: { “status”: “OK”, “results”: [ { “types”: [ “street_address” ], … Read more

Use a URL to link to a Google map with a marker on it

In May 2017 Google launched the official Google Maps URLs documentation. The Google Maps URLs introduces universal cross-platform syntax that you can use in your applications. Have a look at the following document: https://developers.google.com/maps/documentation/urls/guide You can use URLs in search, directions, map and street view modes. For example, to show the marker at specified position … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)