google-maps-api-3

How can i get the total distance in KM in my javascript

独自空忆成欢 提交于 2019-12-25 14:28:47
问题 How can i get the total distance in KM in my javascript. It is shown already on top of the Panel, but i need this value also in my javascript. My javascript is as followed: var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var map = new google.maps.Map(document.getElementById('map'), { zoom:7, mapTypeId: google.maps.MapTypeId.ROADMAP }); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById(

How can i get the total distance in KM in my javascript

谁说我不能喝 提交于 2019-12-25 14:28:33
问题 How can i get the total distance in KM in my javascript. It is shown already on top of the Panel, but i need this value also in my javascript. My javascript is as followed: var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var map = new google.maps.Map(document.getElementById('map'), { zoom:7, mapTypeId: google.maps.MapTypeId.ROADMAP }); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById(

Google map polyLine not clearing

自闭症网瘾萝莉.ら 提交于 2019-12-25 14:03:07
问题 I have a sample google map here where I can draw a polyline and drag the marker to redraw the polyline. When I'm dragging the marker, I'm using Path.setMap(null) to redraw the Polyline as, google.maps.event.addListener(marker, 'dragend', function(event) { var newLatLng = event.latLng; var index = Latlngs.map(function(element) { return element[0]; }).indexOf(marker.id); if (index !== -1) { Latlngs[index] = [marker.id, newLatLng]; } console.log(Latlngs); var changedLine=[]; for (var i = 0; i <

Broken jQuery Accordion in Google Maps

左心房为你撑大大i 提交于 2019-12-25 13:19:14
问题 I am trying to display a jQuery accordion inside of a Google Map, I have it working however when I click away from my accordion menu it will not act as an accordion when I re-open it. I'm at a loss as to how to fix it without creating my own accordion from scratch. Any help as to how to make it work properly? http://mulibraries.missouri.edu/Reference/virtour/demo_fs_mobile.php 回答1: You need create these elements again with events too. I improved your code using jQuery , try this: function

Google Maps API V3 : event listener on a class

别说谁变了你拦得住时间么 提交于 2019-12-25 13:09:27
问题 It is possible to detect an event with Google Maps V3 API, for instance (ex 1) : google.maps.event.addListener('drag', function(event) { $("#latD").val(event.latLng.lat()); $("#longD").val(event.latLng.lng()); }); or (ex 2) google.maps.event.addListener(markerDep, 'drag', function(event) { $("#latD").val(event.latLng.lat()); $("#longD").val(event.latLng.lng()); }); here, I specified an instance of a Marker. According to Google Maps API Specification, one can create a listener on a particular

Google Maps Encode Polyline Rendering Wrong

▼魔方 西西 提交于 2019-12-25 12:42:35
问题 I am having problems rendering polylines on a Google map for my univer. The result should look like the polyline on: http://goo.gl/U18jBJ (Google maps directions from Leeds to London). I am rendering individual paths from each step from the Google directions API instead of just getting a Google directions map, so that I can use a loop to render the individual paths from each step from the Google directions API and the polyline paths in the Rome2Rio Search API result. The following php writes

Change icon on mouseover/out fails

旧巷老猫 提交于 2019-12-25 12:13:06
问题 I'm tearing my hair out over this code. As you may guess, I'm relatively new to coding. I would appreciate any insight you have into why it is not working. I am trying to change marker icons on mouseover/out. I am trying to create and add listeners in a for-loop. In the loop, the markers are created from an array of locations and pushed to another array, a listener is added for mouseover events to change the icon, and another listener is added for mouseout events to nullify the marker icon.

google map api (KML layer)

走远了吗. 提交于 2019-12-25 11:56:25
问题 I tried to draw boundaries of HK island by using KML. Supposed, there would be polygon lines on the map of the Hong Kong island. But nothing shown. Why? Any other methods to import data with coordinates of polygon to google map api? THANKS ! <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0"> <meta charset="utf-8"> <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script> <title>KML Layers</title> <style> html, body {

Google Maps v3 like Pinterest Map (move center position and change markers area)

丶灬走出姿态 提交于 2019-12-25 11:02:31
问题 I want to get the same effect as Pinterest Map (ex. www.pinterest.com/airbnb/loved-by-parisians/) with Google Maps v3. So far I have come to this: http://jsfiddle.net/tdff3/9xEEG/ I get one thing missing: Move the center map position and change the markers visible area to the right, working responsive for different resolutions. Now: What I want: function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng( -33.9, 151.2 ), disableDefaultUI: true, zoomControl: true,

Google Maps v3 like Pinterest Map (move center position and change markers area)

风格不统一 提交于 2019-12-25 11:02:18
问题 I want to get the same effect as Pinterest Map (ex. www.pinterest.com/airbnb/loved-by-parisians/) with Google Maps v3. So far I have come to this: http://jsfiddle.net/tdff3/9xEEG/ I get one thing missing: Move the center map position and change the markers visible area to the right, working responsive for different resolutions. Now: What I want: function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng( -33.9, 151.2 ), disableDefaultUI: true, zoomControl: true,