geolocation

navigator.geolocation.getCurrentPosition doesn't work on android google chrome

不打扰是莪最后的温柔 提交于 2019-11-29 15:57:44
问题 This code: navigator.geolocation.getCurrentPosition( function(position) { alert(position.coords.latitude, position.coords.longitude); }, function(error){ alert(error.message); }, { enableHighAccuracy: true ,timeout : 5000 } ); https://jsfiddle.net/FcRpM/ works in Google Chrome at my laptop, but on mobile HTC one S (android 4.1, GPS off, location via mobile networks and wifi enabled), connected to internet via WiFi. Default browser works fine. Google Chrome, Opera, Yandex.browser for android

How to get the nearest area from a list of locations?

爷,独闯天下 提交于 2019-11-29 15:52:43
问题 I have a API which returns a list of different areas within a city with the weather at that area. I want to get the nearest area based on my current location. API returns Area Latitude Longitude Weather How to find the nearest area based on this data? 回答1: You would have to create CLLocation objects for all the areas, plus one for the current location of the user. Then use a loop similar to the one below to get the closest location: NSArray *allLocations; // this array contains all CLLocation

latitude and longitude bounding box for C#?

早过忘川 提交于 2019-11-29 14:48:59
问题 I just want to find a straightforward, C# class that takes in a starting latitude and longitude and a distance and finds the bounding box (max lat, min lat, max lon, min lon). There are other, similar, questions here on SO but none of them really answer this and the ones that do are not in C#. Help. 回答1: Here's what you are asking for. Kudos to Federico A. Ramponi who wrote the original in Python here. public class MapPoint { public double Longitude { get; set; } // In Degrees public double

Why is IE9 geolocation support broken compared to other browsers?

泄露秘密 提交于 2019-11-29 14:43:02
I'm building a map application and have noticed that although IE9 supports the geolocation api it incorrectly calculates the latitude/longitude. Other users have also noticed this http://social.technet.microsoft.com/Forums/en-IE/ieitprocurrentver/thread/aea4db4e-0720-44fe-a9b8-09917e345080 , but no amount of googling brings up any results from developer blogs/more technical readers... which I find just bizarre, is no one testing their geolocation code in IE9!? Here is my example code: https://gist.github.com/1710256 Does anyone here know why this would be because it makes feature detecting the

MySQL Function to calculate distance between two latitudes and longitudes [closed]

强颜欢笑 提交于 2019-11-29 14:15:10
If you have a latitude and longitude stored in your database and need to calculate the distance between two coordinates. How can you calculate it using a MySQL function? jpgunter After searching around for awhile, I gave up and wrote it myself. I was able to adapt some other code to the following MySQL function. DELIMITER $$ /* Takes two latitudes and longitudes in degrees. You could comment out the conversion if you want to pass as radians. Calculate the distance in miles, change the radius to the earth's radius in km to get km. */ DROP FUNCTION IF EXISTS GETDISTANCE$$ CREATE FUNCTION

how to determine location based on ip

烂漫一生 提交于 2019-11-29 14:11:09
how do one determine location based on ip? I'm not asking for any product or service, but rather how to go about implementing it technically. The ip to country is a rather static mapping. What about more specific locations? geobyte is a good service to locate ip address. If you are thinking about an algorithm to find location based on IP, I think there is none. It is basically a database look up and you will retrieve the location based on the IP address. 来源: https://stackoverflow.com/questions/7337692/how-to-determine-location-based-on-ip

Firefox 5, Geolocating and “Not Now” Issue

纵饮孤独 提交于 2019-11-29 14:03:14
Has anyone out there had to deal with and managed to find a viable workaround for the Firefox 5 geolocation issue I posted in the following bug report. It's easier to link to the report than re-describe it here. https://bugzilla.mozilla.org/show_bug.cgi?id=675533 Surely I'm not the only one on the planet this has bitten. This doesn't really solve the root of your problem but my strategy for handling this is setting a default location point that I use right away (not waiting for the geolocation question to be answered). If I get a location from the user, I just change it to the new location. If

Projecting a point onto a path

自古美人都是妖i 提交于 2019-11-29 12:56:41
Suppose I have an ordered array containing points (lat, lon) describing a path, and I also have a point (lat, lon) describing my current location. How can I project the point onto the path (and place the point in the appropriate place in the array)? What I tried is just simply by searching for the nearest two points and assume it's in the middle of them. It's a good guess, but sometimes fails. What would be a good way of doing this? I see it like this: p0,p1 are path line segment endpoints p is your position q' closest point on line in 3D cartessian q is q' corrected by spherical projection So

how to get latitude/longitude from one geo address using Qt c++ on windows?

核能气质少年 提交于 2019-11-29 12:53:38
Its is possible get the coordinates(latitude and longitude), of a geo location using just the geo address (country, state, city, street, etc...), on Qt c++? I know the libraries QGeoCoordinates, QGeoLocation and QGeoAddress, but i don´t know if is possible get coordinates from an address through them. Every help is welcome. I needed some time to master this but finally I got it working. At first I tried the classes mentioned by you: QGeoAddress , QGeoLocation , QGeoCoordinate : // standard C++ header: #include <iostream> // Qt header: #include <QGeoAddress> #include <QGeoCoordinate> #include

js geolocation but without prompting - possible?

大兔子大兔子 提交于 2019-11-29 11:54:24
Is it possible to get the geolocation of a user without the browser prompt? Here's the code sample from W3 <script> var x = document.getElementById("demo") function getLocation(){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML="Geolocation is not supported by this browser.";} } function showPosition(position){ x.innerHTML="Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script> Is there any preventPrompt() -like function ? No you cant prevent the prompt, its a security feature cause not every