geolocation

Get visitors language & country code with javascript (client-side) [duplicate]

a 夏天 提交于 2019-11-26 14:32:30
This question already has an answer here: Best way to determine user's locale within browser 7 answers Question: Is there a javascript (client-side) code to get visitors country/language code, that is accurate and is cross-"modern"-browser ? I am looking for results like 'en-US' , 'sv-SE' , 'nl-NL' , etc. Related questions to this have been asked before (some SO links: 1 , 2 , 3 , 4 , among others) but I didn't find answer and some of the answers are some yearls old and in some cases referring to even more old articles, which makes me think there are new solutions for this. I tried : var

Google Maps: how to get country, state/province/region, city given a lat/long value?

一世执手 提交于 2019-11-26 14:04:24
I need a list of countries, states & cities based on a collection of lat/long values I have. I need to store this information in a manner that hierarchy is preserve and without duplicates (e.g. "USA" and "United States" and "United States of America" are the same country; I only want one instance of this country in my database). Is this possible to do with Google Map API? What you are looking for is called reverse geocoding . Google provides a server-side reverse geocoding service through the Google Geocoding API , which you should be able to use for your project. This is how a response to the

OnLocationChanged callback is never called

狂风中的少年 提交于 2019-11-26 13:00:00
问题 I am trying to get the users current location using the LocationManager . I have done a lot of research and can\'t seem to find anyone with the same problem. The OnLocationChanged callback never seems to be called. Below is my various code and the logcat. protected LocationListener locationListener; protected LocationManager locationManager; protected Context context; My OnCreate() method @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.v(TAG

How do I enable geolocation support in chromedriver?

↘锁芯ラ 提交于 2019-11-26 12:45:01
问题 I need to test a JS geolocation functionality with Selenium and I am using chromedriver to run the test on the latest Chrome. The problem is now that Chrome prompts me to enable Geolocation during the test and that I don\'t know how to click that little bar on runtime, so I am desperately looking for a way to start the chromedriver and chrome with some option or trigger to enable this by default. All I could find here was however how I can disable geolocation altogether. How can I solve this

How to convert latitude or longitude to meters?

大憨熊 提交于 2019-11-26 12:40:56
If I have a latitude or longitude reading in standard NMEA format is there an easy way / formula to convert that reading to meters, which I can then implement in Java (J9)? Edit: Ok seems what I want to do is not possible easily , however what I really want to do is: Say I have a lat and long of a way point and a lat and long of a user is there an easy way to compare them to decide when to tell the user they are within a reasonably close distance of the way point? I realise reasonable is subject but is this easily do-able or still overly maths-y? b-h- Here is a javascript function: function

NETWORK_PROVIDER not providing updated locations

守給你的承諾、 提交于 2019-11-26 12:38:18
问题 LocationManager locationManager = (LocationManager)getApp().getSystemService(Context.LOCATION_SERVICE); //getApp() returns my Application object locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER , 1, 1, this); locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 1, this); That\'s the code I\'m using to listen. With GPS enabled, everything works fine. However, if I disable GPS and rely on network location, it gives me stale results -- in this case, from

Reading the GPS data from the image returned by the camera in iOS iphone

瘦欲@ 提交于 2019-11-26 12:38:05
问题 I need to get the GPS coordinates of an image taken with the iOS device\'s camera. I do not care about the Camera Roll images, just the image taken with UIImagePickerControllerSourceTypeCamera. I\'ve read many stackoverflow answers, like Get Exif data from UIImage - UIImagePickerController, which either assumes you are using the AssetsLibrary framework, which doesn\'t seem to work on camera images, or use CoreLocaiton to get the latitude/longitude from the app itself, not from the image.

Given the lat/long coordinates, how can we find out the city/country?

萝らか妹 提交于 2019-11-26 12:36:18
For example if we have these set of coordinates "latitude": 48.858844300000001, "longitude": 2.2943506, How can we find out the city/country? Kevin The free Google Geocoding API provides this service via a HTTP REST API. Note, the API is usage and rate limited , but you can pay for unlimited access. Try this link to see an example of the output (this is in json, output is also available in XML) https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true Michael Borgwardt Another option: Download the cities database from http://download.geonames.org/export/dump/

Calculate new coordinate x meters and y degree away from one coordinate

谁都会走 提交于 2019-11-26 12:22:58
I must be missing somthing out in the docs, I thought this should be easy... If I have one coordinate and want to get a new coordinate x meters away, in some direction. How do I do this? I am looking for something like -(CLLocationCoordinate2D) translateCoordinate:(CLLocationCoordinate2D)coordinate translateMeters:(int)meters translateDegrees:(double)degrees; Thanks! Unfortunately, there's no such function provided in the API, so you'll have to write your own. This site gives several calculations involving latitude/longitude and sample JavaScript code. Specifically, the section titled

Get current location of user in Android without using GPS or internet

Deadly 提交于 2019-11-26 12:02:36
Is it possible to get the current location of user without using GPS or the internet? I mean with the help of mobile network provider. What you are looking to do is get the position using the LocationManager.NETWORK_PROVIDER instead of LocationManager.GPS_PROVIDER . The NETWORK_PROVIDER will resolve on the GSM or wifi, which ever available. Obviously with wifi off, GSM will be used. Keep in mind that using the cell network is accurate to basically 500m. http://developer.android.com/guide/topics/location/obtaining-user-location.html has some really great information and sample code. After you