Sending a details request to Google Places API – (CORS error) [duplicate]

The previous answer suggests using a server-side proxy. While that is a good solution for the general case of accessing a web API that does not support CORS or JSONP, it’s not the best solution for this specific problem. Instead, use Google’s JavaScript Places Library which is designed specifically for this kind of use. The … Read more

Directions API overview_polyline doesn’t have correct points

I have had success using Mark McClure’s tools: http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/ on archive.org Your polyline works for me when I use this tool to decode it: http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/decode.html on archive.org and this to display the results: http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/encodeForm.html on archive.org Encoded polylines often have issues with “\” escaping the next character. See this example [1] (can’t seem to get … Read more

Highlighting borders of state and cities of US in Google Map API 3

True. Google does not provide this feature. So what we can do… we can have the lat/long of the borders of the state. And we have to draw polygons ourselves. I used this JS object. And changed it to Google map object (google.maps.LatLng). For example: var statesobj = {“AK”: [new google.maps.LatLng(70.0187, -141.0205), new google.maps.LatLng(70.1292, -141.7291), … Read more

Leaflet Map API with Google Satellite Layer [duplicate]

You don’t need a plugin or the Google API, you can add it as a XYZ tile layer. Streets googleStreets = L.tileLayer(‘http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Hybrid: googleHybrid = L.tileLayer(‘http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Satellite: googleSat = L.tileLayer(‘http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Terrain googleTerrain = L.tileLayer(‘http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}’,{ maxZoom: 20, subdomains:[‘mt0′,’mt1′,’mt2′,’mt3’] }); Note the difference in the … Read more

click event listener on styled map icons and labels

There is no API-based access to the POI’s . But there is a possible workaround. When you click on a POI an InfoWindow opens. It’s possible to modify the InfoWindow-prototype to be able to access the content of the InfoWindow without having a reference to the InfoWindow-instance. //store the original setContent-function var fx = google.maps.InfoWindow.prototype.setContent; … Read more