google-maps-api-3

How do I show multiple locations in Google Maps?

心已入冬 提交于 2020-01-29 13:11:33
问题 I have multiple longtitude and attitude data and I want to show them in the google map with pins. How to use the google map API to do this? 回答1: You iterate over your array, and create a new Marker instance for each pair. It's simple: <script> var map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(55.378051, -3.435973), mapTypeId: google.maps.MapTypeId.ROADMAP, zoom: 8 }); var locations = [ new google.maps.LatLng(54.97784, -1.612916), new google.maps

How do I show multiple locations in Google Maps?

99封情书 提交于 2020-01-29 13:10:49
问题 I have multiple longtitude and attitude data and I want to show them in the google map with pins. How to use the google map API to do this? 回答1: You iterate over your array, and create a new Marker instance for each pair. It's simple: <script> var map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(55.378051, -3.435973), mapTypeId: google.maps.MapTypeId.ROADMAP, zoom: 8 }); var locations = [ new google.maps.LatLng(54.97784, -1.612916), new google.maps

Google map alternative roads show with different colour

梦想与她 提交于 2020-01-28 12:33:27
问题 I have the following google map JsFiddle - where i need to display multiple option between 2 location - what i did show only one route - need if possible 2 more to draw with different color. In documentations what i got i wasn't to clear for me to solve. $(document).ready(function(){ var markers = [ { "title": '', "lat": '56.965969', "lng": '24.143496', "description": '' } , { "title": '', "lat": '56.966259', "lng": '24.385860', "description": '' }]; var mapOptions = { zoom: 11, center: new

Google Autocomplete Places API not triggering event on change via TAB

落爺英雄遲暮 提交于 2020-01-28 05:27:26
问题 Per the Google Autocomplete Places API documentation, the getPlace() call should return a Places object with all the location data, or, if that place doesn't exist (i.e. - the user ignored the suggestions), it should return a stub with just the name element of the Places object filled in. However, it only does this latter operation when the user hits ENTER, not if they TAB out of the field. I've tried looking at the change event, the keyup, keydown events. I've tried triggering a keydown

Google Autocomplete Places API not triggering event on change via TAB

时间秒杀一切 提交于 2020-01-28 05:26:06
问题 Per the Google Autocomplete Places API documentation, the getPlace() call should return a Places object with all the location data, or, if that place doesn't exist (i.e. - the user ignored the suggestions), it should return a stub with just the name element of the Places object filled in. However, it only does this latter operation when the user hits ENTER, not if they TAB out of the field. I've tried looking at the change event, the keyup, keydown events. I've tried triggering a keydown

Integrate Google Maps MarkerClusterer with infowindow

我是研究僧i 提交于 2020-01-28 05:21:43
问题 I'm trying to put InfoWindow in multiple markers grouped with MarkerClusterer, but without sucess. I only can generate maps with infowindows OR with cluster; not both at same time. Searching over web makes me more confuse.... The start point was google developers page: with my needs, I created the following code: <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 5, center: {lat: -15.7942357, lng: -47.8821945} }); // Add

Integrate Google Maps MarkerClusterer with infowindow

夙愿已清 提交于 2020-01-28 05:20:31
问题 I'm trying to put InfoWindow in multiple markers grouped with MarkerClusterer, but without sucess. I only can generate maps with infowindows OR with cluster; not both at same time. Searching over web makes me more confuse.... The start point was google developers page: with my needs, I created the following code: <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 5, center: {lat: -15.7942357, lng: -47.8821945} }); // Add

Google Map API v3 ~ Simply Close an infowindow?

别等时光非礼了梦想. 提交于 2020-01-27 03:22:34
问题 Trying to simply close an infowindow? I already have an array of markers, so something like this would be good. Thanks MyMarkers[i].infowindow.close(); 回答1: With the v3 API, you can easily close the InfoWindow with the InfoWindow.close() method. You simply need to keep a reference to the InfoWindow object that you are using. Consider the following example, which opens up an InfoWindow and closes it after 5 seconds: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text

How to show labels with direction on google map api

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-26 04:54:36
问题 I would like to show a label with a direction icon similar to the one shown in the picture (captured from default embedded iframe). The following is my current code. google.maps.event.addDomListener(window, 'load', init); var lat = 25.2091043; var lng = 55.2725799; function init() { var mapOptions1 = { zoom: 18, center: new google.maps.LatLng(lat, lng), mapTypeId: google.maps.MapTypeId.ROADMAP }; var contentString = '<div id="content">'+ '<div id="siteNotice">'+ '</div>'+ '<h2 class="title

Javascript, How can I make use of switch case in the zoom_changed listener in google maps?

偶尔善良 提交于 2020-01-26 04:43:07
问题 I have several markers on my webpage and I am making use of Overlapping Markers library : https://github.com/jawj/OverlappingMarkerSpiderfier . What I am trying to do is : When the user first lands on the webpage, the default zoom level is 6 . When they click on a bunch of overlapping markers, the markers don't spiderfy but rather zooms in on them to a zoom level of 9 . Once the zoom level == 9 , if they click on the markers, they will spiderfy and then they can click on individual markers