google-maps

window.google is undefined in react?

我的梦境 提交于 2021-02-04 19:51:33
问题 When I call window and console log it I get a google prop as you see here: Yet when I try to call window.google I get undefined. Am I missing something here? 回答1: Hey I came across a similar issue trying to instantiate a new window.google.maps.Map and found this solution helped me. When declaring your <script> tag, give it an identifier so that you can grab it later in your component. On the mounting of your component, set up a load event listener on the Google script and wait until it's

Google Maps Directions in current traffic with waypoints

♀尐吖头ヾ 提交于 2021-02-04 19:11:14
问题 I am using the google maps api to get directions with the durationInTraffic option. var request = { origin: start_address, destination: end_address, waypoints: waypts, durationInTraffic: true, optimizeWaypoints: true, travelMode: tmode }; directionsService.route(request, function(response, status) { .... This is working fine with a start and end address with no waypoints, as seen below: My problem is that when i add a waypoint to to route then the "time in current traffic" estimate is no

Google Maps Directions in current traffic with waypoints

邮差的信 提交于 2021-02-04 19:10:14
问题 I am using the google maps api to get directions with the durationInTraffic option. var request = { origin: start_address, destination: end_address, waypoints: waypts, durationInTraffic: true, optimizeWaypoints: true, travelMode: tmode }; directionsService.route(request, function(response, status) { .... This is working fine with a start and end address with no waypoints, as seen below: My problem is that when i add a waypoint to to route then the "time in current traffic" estimate is no

Google Maps Directions in current traffic with waypoints

不想你离开。 提交于 2021-02-04 19:08:12
问题 I am using the google maps api to get directions with the durationInTraffic option. var request = { origin: start_address, destination: end_address, waypoints: waypts, durationInTraffic: true, optimizeWaypoints: true, travelMode: tmode }; directionsService.route(request, function(response, status) { .... This is working fine with a start and end address with no waypoints, as seen below: My problem is that when i add a waypoint to to route then the "time in current traffic" estimate is no

How to detect button click in googlemaps infowindow [duplicate]

天涯浪子 提交于 2021-02-04 18:48:08
问题 This question already has an answer here : using addDomListener with googlemaps not working (1 answer) Closed 6 years ago . Using Googlemaps V3 I am trying to add a button to the infoWindow on my googlemap. The infoWindows and button appear as expected. I am trying to capture the onclick event of the button. This is what I have so far: var contentBtn = '<p><button id="marker'+numby+'" class="iwLink" href="#" >Done</button></p>'; google.maps.event.addListener(marker, 'click', function() {

How to update marker positions with data from Firebase Google Maps API Android

爷,独闯天下 提交于 2021-02-04 08:20:11
问题 I'm creating an app that makes a real time tracking of users using Firebase Database. Every user is displayed in the map using markers. When there is a new location update, the marker has to be updated. The problem is that with Firebase method onDataChange() or similars every time a new location update is retrieved, I can't access to the old marker to remove it and create a new one or just update the old marker, because the marker doesn't exist. I tried it saving markers in SharedPreferences

Draw a polyline on the map using GMap.net

爱⌒轻易说出口 提交于 2021-02-04 05:19:32
问题 Yep, I am not the first who is asking, but I didn't found an answer (maybe, because my english is bad). How to draw a polyline on a map? Not a route (direction), but just a polyline, like in JS Google Maps API with function Polyline. I can not understand. Thanks anyway. 回答1: Have a good read of this tutorial: http://www.independent-software.com/gmap-net-tutorial-maps-markers-and-polygons/ This should get you started: GMapOverlay polyOverlay = new GMapOverlay("polygons"); IList<PointLatLng>

Draw a polyline on the map using GMap.net

喜你入骨 提交于 2021-02-04 05:11:30
问题 Yep, I am not the first who is asking, but I didn't found an answer (maybe, because my english is bad). How to draw a polyline on a map? Not a route (direction), but just a polyline, like in JS Google Maps API with function Polyline. I can not understand. Thanks anyway. 回答1: Have a good read of this tutorial: http://www.independent-software.com/gmap-net-tutorial-maps-markers-and-polygons/ This should get you started: GMapOverlay polyOverlay = new GMapOverlay("polygons"); IList<PointLatLng>

How to focus on the marker position with zoom in react using react-google-maps package

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-02 09:38:08
问题 How to focus with zoom to the marker position. Once the marker position changes to different location I need to manually zoom in and out and go to the market location. Literally I need to manually scroll and zoom into the position of the marker which is difficult. I am using https://github.com/tomchentw/react-google-maps package Sample output of below code. Output Gif Image Link import React from 'react'; import { compose, withStateHandlers } from "recompose"; import { InfoWindow,

How to focus on the marker position with zoom in react using react-google-maps package

非 Y 不嫁゛ 提交于 2021-02-02 09:37:14
问题 How to focus with zoom to the marker position. Once the marker position changes to different location I need to manually zoom in and out and go to the market location. Literally I need to manually scroll and zoom into the position of the marker which is difficult. I am using https://github.com/tomchentw/react-google-maps package Sample output of below code. Output Gif Image Link import React from 'react'; import { compose, withStateHandlers } from "recompose"; import { InfoWindow,