google-distancematrix-api

Google Maps: ReferenceError: google is not defined in cordova android application

允我心安 提交于 2020-01-25 06:47:25
问题 I'm trying to create a cordova project that marks some locations in map and getting the distance in between the selected location and current location of the user. I have used cordova-plugin-googlemaps for displaying the google map and used cordova-plugin-googlemaps and for getting the distance netween the selected location and current location of the user I have used the code from google map distance matrix service I am getting ReferenceError: google is not defined when I run my cordova

Google DistanceMatrix API

巧了我就是萌 提交于 2020-01-23 01:35:12
问题 I'm trying to get the direction_in_traffic , which isn't returned using the regular directions api. I've found that there is a field in the distancematrix api that does just that. This code works when I run it from my own machine, but once it is online, I see errors concerning Access-Control-Allow-Origin var durationInTraffic = function(from, to, mode, callback) { var key = 'API-KEY'; var address = 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=' + from + '&destinations=' +

Sometime Google Distance Matrix ZERO_RESULTS returned

僤鯓⒐⒋嵵緔 提交于 2020-01-06 15:43:59
问题 It is my first question about that is working if I set default lat and long and now I try to get location current location and use that. Also I following this one Get User's Current Location / Coordinates but failed to reach result. I am not sure what is going on here it is not working try to do it several way func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { //print(locations) //get the actual location from the device and first one each move let

Lambda expression returning null android

隐身守侯 提交于 2020-01-06 14:16:36
问题 I'm writing a lambda expression to convert the given latitude and longitude into an address. The expression is supposed to take co-ordinates as arguments and returns their corresponding address. However, the value returned is null. Following is my class: public class LambdaDeclarations { String loc; private static final String TAG = "LambdaDeclarations"; public CoordinatesToAddressInterface convert = (latitude, longitude, context) -> { RequestQueue queue = Volley.newRequestQueue(context); Log

how to returning distance with function in google maps

旧城冷巷雨未停 提交于 2019-12-25 16:56:19
问题 i've script from this link here and i want to make the function returning distance, this's my actually script : var calcRoute = function(origin,destination) { var dist; var directionsDisplay; var directionsService = new google.maps.DirectionsService(); directionsDisplay = new google.maps.DirectionsRenderer(); var request = { origin:origin, destination:destination, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status =

how to calculate distance and duration for multiple locations using Distance Matrix or other google APIs?

落花浮王杯 提交于 2019-12-25 09:11:36
问题 I want to calculate distance and time for below scenario, Start Point : A A to 1(via)(2 km)(2 min) A to 2(via)(5 km)(7 min) A to 3(via)(8 km)(13 min) A to B(16 km)(22 min) End Point : B because of this I get the path through Distance Matrix, then Google Map returns the shortest established path between points. But I don't want shortest, I want to calculate via. Please tell me hint or proper way. 回答1: public class DirectionsJSONParser { /** * Receives a JSONObject and returns a list of lists

Unable to fetch Response For Google Distance matrix in Swift

心已入冬 提交于 2019-12-24 07:27:11
问题 I am using below code to get json response for Google maps api , Unable to get json response. Making get request using Alamofire pod. Alamofire.request( "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&key=<API_KEY>",method: .get,encoding: JSONEncoding.default) .responseString {response in print(response.request) // original URL request print(response.response) // HTTP URL response print(response.data) // server data

google distance matrix on localhost

南楼画角 提交于 2019-12-24 05:48:51
问题 I am trying to use google distance matrix to find out the distance and time from one source to one destination. I am calling the function $('#postCode').change(function () { var address = "sydney"; var source = "melbourne" var url = "https://maps.googleapis.com/maps/api/distancematrix/js?units=imperial&origins=" + address + "&destinations=" + source + "&key=MYKEY_HERE"; $.get(url, function (data) { window.alert(data); }); }); I just need to get whatever data is returned but the problem is

Why Google direction and distance matrix API show different results for source and destination value

China☆狼群 提交于 2019-12-24 01:39:07
问题 I am trying to get distance and duration using google direction API https://maps.googleapis.com/maps/api/directions/json?origins=latitude,longitude&destinations=latitude,longitude&&mode=driving&key=xxxxxxxxxxxxxxxxxxxxx and its working fine and get the distance and duration like this distance="30 m" duration="1 min" when am trying get distance and duration using distancematrix api, https://maps.googleapis.com/maps/api/distancematrix/json?origins=latitude,longitude&destinations=latitude

How to use Google Maps Distance Matrix JAVA API to obtain closest distance between source and multiple destinations

会有一股神秘感。 提交于 2019-12-24 01:36:20
问题 I have added the dependency of Google Maps API Java Client in my Java project. I have a set of origin distances, destination distance and also teh GeoApiContext as such: GeoApiContext context = new GeoApiContext().setApiKey(MY_API_KEY); String[] destinationAddress = {"40.7127837,-74.0059413", "33.9533487,-117.3961564", "38.6270025,-90.19940419999999"}; String[] originAddress = {"12.8445,80.1523"}; I want to get the (Airplane?) Distances between these points. I know we can send a simple HTTP