geolocation

How can I get the current gps location every time a function is called?

好久不见. 提交于 2019-12-23 03:21:11
问题 What I want to do is to get the location latitude and longitude each time a function is called. As I have understood the best way to do that is to leave the location update for a few seconds to get the correct fix and then disable it, but I can't make it work in my app. What I have managed until now is to get the last known location of the phone, every time the displayData function is called, but I have not been able to get over all the errors that appear when I'm trying to change to

Determine if a Longitude & Latitude Co-ordinate is Inside a Radius in Miles and Kilometers

大城市里の小女人 提交于 2019-12-23 03:07:31
问题 Using only pseudo-code or JavaScript, can anyone describe the best way to determine which items in array of objects composed of: { "lat": float, "lng": float } are within a given radius in either miles or kilometers? I am adding geo-location-based queries to ForerunnerDB (https://github.com/irrelon/ForerunnerDB) and would like to be able to produce fast results from the search. Bonus points if you can describe an indexing strategy that will speed up the query over the array. I have written

MySQL GeoSpatial function for ST_Distance_Spheroid? Metric used in return Type of GLength?

ぃ、小莉子 提交于 2019-12-23 02:58:20
问题 Is there a ST_Distance_Sphere, ST_Distance_Spheroid equivalent function in MySQL's GeoSpatial Support? If not, any way to emulate this? What is the metric used in return type of GLength (length of the LineString)? The manual for GLength says that GLength() is a nonstandard name. It corresponds to the OpenGIS Length() function. But I couldn't find any Docs for OpenGIS Length(). All I found was for ST_Length are they the same? Also for accuracy do I need to specify the SRID(4326)? How Do I do

How to get timezone by latitude and longitude [duplicate]

孤街醉人 提交于 2019-12-23 01:46:28
问题 This question already has answers here : How to get a time zone from a location using latitude and longitude coordinates? (15 answers) Closed 4 years ago . I need to display date and time based on the given lat/long in the app. I worked with Google API to get the timezone ID, but it should work offline too. Is there any way to get timezone without being connected to the internet? 回答1: Try this one : CLLocation *location = [[CLLocation alloc] initWithLatitude:50.449846 longitude:30.523629];

How to get timezone by latitude and longitude [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-23 01:46:04
问题 This question already has answers here : How to get a time zone from a location using latitude and longitude coordinates? (15 answers) Closed 4 years ago . I need to display date and time based on the given lat/long in the app. I worked with Google API to get the timezone ID, but it should work offline too. Is there any way to get timezone without being connected to the internet? 回答1: Try this one : CLLocation *location = [[CLLocation alloc] initWithLatitude:50.449846 longitude:30.523629];

Mongo geolocation using $near and 2d index not being accurate

青春壹個敷衍的年華 提交于 2019-12-23 01:37:20
问题 I've written an application that finds local establishments and delivers them via a RESTful API. My stack is: express, express-resource and mongoose. Here is a sample of my model: var PlaceSchema = new mongoose.Schema( { name: { type: String, required: true }, geolocation: { lat: Number, lng: Number }, address: { type: String } } ); PlaceSchema.index({ geolocation: '2d' }); I've checked a few times and my lon/lat values are being correctly stored in the db, so there aren't any data errors.

Using AJAX to send lat & lng variables to PHP for proximity calculation

扶醉桌前 提交于 2019-12-23 01:07:47
问题 To start, thank you in advance for all insight and assistance. I have a MySQL database (single table, really) with 9 entries for testing. Fields include id, name, address, city, state, zip, lat, lng, etc. My goal is to load a main page with location awareness enabled, use Javascript to set user latitude and longitude as variables, then using AJAX, send those variables to another .php page so the variables can be placed into the calculation formula in my query. There is a second AJAX instance

watchPosition() and getCurrentPosition

余生颓废 提交于 2019-12-22 20:43:13
问题 What is the difference between getCurrentPosition() and watchPosition() . I read several articles about getCurrentPosition() and watchPosition() . But none of was clear to me. As far as I'm understand getCurrentPosition() update location only one time But watchPosition() continuously update location. I'm I right?? 回答1: getCurrentPosition() gives currentPosition latitude and longtitude values,which fires only once. Where as watchPosition() gives currentPosition latitude and longtitude values

Why is HTML5 geolocation slower than native on Android?

半城伤御伤魂 提交于 2019-12-22 18:26:12
问题 I've been dabbling with hybrid app development using Cordova (an extendable web view wrapper for those who haven't used it). One thing that I've noticed is that whenever I request the user's location with window.geolocation , the location fix almost always takes longer compared to a native app. For instance, it will take 5 or 6 seconds to get a suitable fix with window.geolocation from a "cold start", but the Google Maps app will pan to my location within 2 seconds or less. The same seems to

How to save HTML5 geolocation data to python Django admin?

女生的网名这么多〃 提交于 2019-12-22 18:19:44
问题 Is it possible to save the javascript html5 geolocation latitude and longitude to the django admin when user uses the geolocation website. The web page goal is to save the user's longitude and latitude values so that the data can be accessed later on when user signs in again. I found a similar question being asked in stackoverflow years ago but there hasn't been any answer. The link is : Save JavaScript GeoLocation data to Django admin page It would be great if there this an answer based on