geolocation

google.maps.Geocoder.geocode() geometry.location lat/lng property names change frequently

此生再无相见时 提交于 2019-11-27 01:23:40
I have an application, and I'm using the Google Javascript Geocoding API to fetch lat/lng for an address. The code goes something like geocoder = new google.maps.Geocoder() geocoder.geocode({ 'address': query }, function(results, status) { addresses = {}; $.each(results, function(index, value){ addresses[index] = {"lat":value.geometry.location.$a,"lng":value.geometry.location.ab} }) }); All is fine and dandy, but the thing is that the property names of the location object periodically change. Each time they change, my site breaks. Twice I've had to change my code to accommodate the weird lat

Bearing from one coordinate to another

喜欢而已 提交于 2019-11-27 01:22:10
问题 I implemented the "bearing" formula from http://www.movable-type.co.uk/scripts/latlong.html. But it seems highly inaccurate - I suspect some mistakes in my implementation. Could you help me with finding it? My code is below: protected static double bearing(double lat1, double lon1, double lat2, double lon2){ double longDiff= lon2-lon1; double y = Math.sin(longDiff)*Math.cos(lat2); double x = Math.cos(lat1)*Math.sin(lat2)-Math.sin(lat1)*Math.cos(lat2)*Math.cos(longDiff); return Math.toDegrees(

W3C Geolocation API not working in Chrome

爱⌒轻易说出口 提交于 2019-11-27 01:21:31
问题 The below code works in Firefox but not in Google Chrome: <!DOCTYPE html> <html> <head> <title>title</title> <script type="text/javascript"> var successCallback = function(data) { console.log('latitude: ' + data.coords.latitude + ' longitude: ' + data.coords.longitude); }; var failureCallback = function() { console.log('location failure :('); }; var logLocation = function() { //determine if the handset has client side geo location capabilities if(navigator.geolocation){ navigator.geolocation

High accuracy geolocation Html5

喜你入骨 提交于 2019-11-27 01:01:58
问题 I am tring to locate a device using the embedded GPS (like whats app share location). I've read that it is possible with enableHighAccuracy: true . How can I set enableHighAccuracy: true in this code? I tried in different positions but it doesn't work. <script type="text/javascript"> if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; var accuracy = position.coords

How does IP geolocating work?

主宰稳场 提交于 2019-11-27 01:00:46
问题 I'm not looking for a service that does this. I'm just curious as to how geolocation works. 回答1: Mapping IP addresses to geolocations is done via tables, where an IP maps to a particular location. This location, however, does't need to be accurate, since IP addresses don't carry any information about their locations, these are approximated . From http://en.wikipedia.org/wiki/Geolocation_software: The primary source for IP address data is the regional Internet registries which allocate and

How to base64 encode inside of javascript

╄→гoц情女王★ 提交于 2019-11-27 00:30:27
问题 I am trying to implement a simple script on a site that will return base64 encoded information from google's ajax API. This is what I am playing with so far: <html> <head> <script src="http://www.google.com/jsapi?key=ABQIAAAA0duujonFsEX871htGWZBHRS76H0qhS7Lb-D1Gd0Mnaiuid8Z7BQIyz2kMpojKizoyiCQA4yRkKAKug" type="text/javascript"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> jQuery(document)

Android - How to get estimated drive time from one place to another?

烈酒焚心 提交于 2019-11-27 00:24:18
问题 I need to find the estimate drive time from one place to another. I've got latitudes and longitudes for both places but I have no idea how to do that. Is there is any API for that. help thanks. 回答1: yes you get the time and distance value as well as many like direction details in driving, walking etc mode. all you got from the google direction api service check our this links http://code.google.com/apis/maps/documentation/directions/ 回答2: Location location1 = new Location(""); location1

Which Devices Support Javascript Geolocation via navigator.geolocation?

送分小仙女□ 提交于 2019-11-27 00:23:17
The iPhone supports geolocation in mobile Safari via the following call: navigator.geolocation.getCurrentPosition( function(pos){ var lat = pos.coords.latitude; var long = pos.coords.longitude; }, function(){ /* Handler if location could not be found */ } ); I'd like to build a good list of devices that have one of the following: support this feature out of the box , or support this feature with an upgrade, or support geolocation with equivalent fidelity of data with some other snippet of Javascript. I'm only familiar with my own device, so this is my list so far: Out of the box: iPhone 3GS

How can I use HTML5 geolocation in angularjs

百般思念 提交于 2019-11-27 00:11:16
问题 How can I use HTML5 geolocation in angularjs? I can get it using HTML5; but how can I pass it to angularjs scope in controller? any sample jsfiddle will save my day! 回答1: you can do something myApp.controller('fooCtrl', function($scope){ if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position){ $scope.$apply(function(){ $scope.position = position; }); }); } }) you need to do $scope.$apply to trigger the digest cycle when the geolocation arrives and to update

Converting latitude and longitude to decimal values

旧街凉风 提交于 2019-11-27 00:06:26
I have GPS information presented in the form: 36°57'9" N 110°4'21" W I can use the javascript functions of Chris Veness to convert degrees, minutes and seconds to numeric degrees, but first need to parse the GPS info into the individual latitude and longitude strings (with NSEW suffixes). I have read related posts on stackoverflow, but am not a regex expert (nor a programmer) and need some help with the parsing function. What's the best way to parse this string into latitude and longitude for use in the conversion function? The result of all this will be a Web link that one can click on to see