geolocation

Does Google offer an API that I can use to get the location of my phone?

℡╲_俬逩灬. 提交于 2019-12-03 12:00:23
问题 My smartphone reports my location to Google (to G+ and to the Android Device Manager). I'd like to read that location from a website/program to plot my location. I could use another app on my smartphone doing extra tracking but that tends to drain the battery quite a bit (having two apps do the tracking). Since Latitude was deprecated I can't seem to find a replacement. 回答1: As part of Android Google is offering a location API. However, it sounds like you are looking for some kind of personal

navigator.geolocation.getCurrentPosition Callbacks won't work on Firefox 10

我的梦境 提交于 2019-12-03 11:39:57
问题 I am building an app that uses the Geolocation API. I cant seem to get a very simple piece of code to work on Firefox 10. Here is the code: window.onload = function() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { alert('it works'); }, function(error) { alert('Error occurred. Error code: ' + error.code); }); }else{ alert('no geolocation support'); } }; So ,for example, in chrome, after running the page I will be asked if I want to share my

How to easily get a zipcode from a generic address with google maps api?

一曲冷凌霜 提交于 2019-12-03 11:36:36
I am trying to get the postal code of a generic address such as "los angeles, ca". When I do this: gcode = new google.maps.Geocoder() gcode.geocode({'address': 'Los Angeles, CA'}, function(results, status) { log(results); }); >> [Object { address_components=[4], formatted_address="Los Angeles, CA, USA", geometry={...}, more...}] I get an object returned that does not have a zipcode... However, if I then take the location object returned from that, then I do get access to a zipcode: gcode.geocode({'latLng': results[0].geometry.location}, function(results, status) { log(results[0].address

current location is always null

本小妞迷上赌 提交于 2019-12-03 11:21:38
问题 I am trying to retrieve my current location on the button click in an editbox using gps or network..i have tried all possible methods which i found in tutorials and older posts....but my location is always null.. i am not getting where i am wrong.? i am testing it on real device having network but no internet/gprs... this is the code which i am using..i tried the same with GPS_PROVIDER as well ..please help me.. protected void showCurrentLocation() { geocoder = new Geocoder(this);

Best way to get user nearest city? Python/Django

非 Y 不嫁゛ 提交于 2019-12-03 11:14:57
问题 I have a website with a limited number of cities in the database, and need to show the user the nearest city to his current location. I can get the location by MaxMind API, but I want to get the nearest city in my database to user city. For example, if I have these cities in the database: Los Angeles , San Francisco and New York City , and I'm accessing from other city like Miami , I should see NYC selected because it's the nearest geographically. What's the best way to do this quick and

Geolocation in C#

牧云@^-^@ 提交于 2019-12-03 11:12:42
I'm trying to develop an application that should be something like a game. The user would have some locations in a city and he would have to do something on each location. In order to track the position of the user, I have tried using geolocation with the following code: Geolocator geolocator = new Geolocator(); //geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High; geolocator.DesiredAccuracyInMeters = 50; try { Geoposition geoposition = await geolocator.GetGeopositionAsync(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1)); textLatitude.Text = "Latitude: " +

Javascript or Python - How do I figure out if it's night or day?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 11:03:54
问题 any idea how I figure out if it's currently night/day or sunrise/dawn based on time and location of the user? I haven't found anything useful that I could use within either the client or backend. What makes it tricky is the hour doesn't necessarily define if it is night and day, this depends pretty much on the year, month, day, hour and geo coordinates. For clarification... to emulate something like this. A way to approximate this would be very useful as well. Hope that someone can help! 回答1:

How do i track the visitor's country and redirect them to appropriate sites?

瘦欲@ 提交于 2019-12-03 10:38:36
问题 I want to track the country of the visitors and then redirect them to appropriate subdomains of my site like what google does... And upto what extent i can rely on the data of the api if i should use any?.. I'm using php.. 回答1: Download and install Maxmind's GeoLite Country database, which claims 99.5% accuracy. You can pay to upgrade to a paid version with a claimed 99.8% accuracy. There are four options with respect to how to use the database from PHP: Download the CSV file and import it

Get Windows TimeZoneInfo from Latitude and Longitude

限于喜欢 提交于 2019-12-03 10:02:57
问题 In a web app I have people enter their address, then I use Google's geocode API to get their latitude and longitude. Next, I would like to get their Windows time zone name using these coordinates so I can deal with Daylight Savings Time correctly via the .Net TimeZoneInfo object. I played with several of the available time zone web services to get the time zone name such as: http://www.askgeo.com/ http://www.geonames.org/ http://www.earthtools.org/ The issue is that these all return either

Get current position in Google Maps JavaScript API v3 and get the dot to follow me without user interaction

蓝咒 提交于 2019-12-03 09:54:31
I am assuming this is not possible or advisable due to the nature of the web but I will ask anyway. I know I can get a user's current location and centre on a map using the Google Maps JavaScript API v3. I can even get it to show a dot for where the user is currently located. What I really want to know, and my client is asking for this, is can I get the dot to follow the user around without user interaction (ie.. the user does not interact with the device, the dot just moves when the user moves.)? All I can think of is that I would need to add a timer event to continuously check the current