geolocation

How to pass a second parameter to geolocation success function ?

人盡茶涼 提交于 2019-12-11 12:57:19
问题 This is what I'd like to do: navigator.geolocation.getCurrentPosition( wallEventByCat( variable, position ), handle_errors ); in order to have this kind of callback: function wallEventByCat( position, category ) { } Is this doable ? if yes, how ? Thanks 回答1: You should use an anounymous function like: navigator.geolocation.getCurrentPosition( function(position){ wallEventByCat( variable, position ); }, handle_errors ); 来源: https://stackoverflow.com/questions/22032361/how-to-pass-a-second

Obtain the latitude and longitude using the pincode on google maps

狂风中的少年 提交于 2019-12-11 12:38:16
问题 I have a requirement to loading a Google map location given the pin code or area code. I've tried using the Geocoder method to find the latitude and longitude using a given address. This works when a location or area is given, but is not working for the pincode (specifically India). Is there is any method or way to find the latitude and longitude of a given area using the pincode. This is specific to a map to be loaded on android, using the mapview. The code i've written is given as: package

define geo index in ArangoDB

倖福魔咒の 提交于 2019-12-11 12:15:52
问题 I have a data structure like below. how can I define a geo index for that structure? { "currentGeoLocation": { "latitude": -10, "longitude": 1 } } I tried these command: 1- db.test.ensureIndex({ type: "geo", fields: [ "currentGeoLocation[latitude]","currentGeoLocation[longitude]" ] }); 2- db.test.ensureIndex({ type: "geo", fields: [ "currentGeoLocation.latitude","currentGeoLocation.longitude" ] }); but I think none works correctly. because after I search the nearest items, I got []. whats the

How to programmatically turn GPS on and off in Windows Phone 7

馋奶兔 提交于 2019-12-11 12:14:58
问题 So far, to turn on and off the GPS device in Wp7, I do it in Settings Menu. Wonder If this can be done in code? Thanks ---------- Update Sorry for the confusion. Instead of turning GPS on and off, What I really mean is how to turn on and off the LOCATION in the Settings Menu of Wp7. 回答1: You can get the GPS data but you are not able to turn the sensor on or off via your application. The most you can do in your application is start the geolocation data acquisition and stop it. 回答2: Windows

Javascript GeoLocation Caching

眉间皱痕 提交于 2019-12-11 12:08:26
问题 I'm using the following to successfully capture user's location (mobile browser): <script> if ( navigator.geolocation ) { navigator.geolocation.getCurrentPosition(handlePosition); } function handlePosition(pos) { //this passes lat/long to additional code } </script> This works, but often times the browser will seemingly cache the location data. The page that calls this geolocation code shows information relative to the user's location, so what happens is the user can move (change location),

Select items within range using MySQL spatial extensions?

半世苍凉 提交于 2019-12-11 11:42:23
问题 I am completely new to MySQL spatial extensions, so please excuse my ignorance on the topic. The scenario: 1) I collect a user's location via latitude and longitude. I store that location in a MySQL table. 2) I then display any other users within a range of that user. The range would be small - let's say 1000 ft. Question: What is the best practice for storing the location points? What is the best practice for querying and selecting the points nearest that user? 回答1: Use the POINT Spatial

GPS accuracy of Android Emulator

人走茶凉 提交于 2019-12-11 11:24:02
问题 I am developing a website which used W3C GeoLocation API to obtain users' position. I try to run the website in Android Emulator and use DDMS / geo fix to send the coordinate to the device. However the coordinate received is inaccurate. For example, (22.377127, 114.095535) will become (22.370335, 114.08523353). I try to run some Android GPS example from Internet, and the results is just the same. I can certainly say that this is not my program bug. From my observation, it seems like some

Verify user input location string is a valid geographic location?

☆樱花仙子☆ 提交于 2019-12-11 10:27:10
问题 I'm accepting a user input which is supposed to be a geographic location. I would like to validate that what the user has entered describes a location--e.g., postal code, airport code, street address, city name, etc. The obvious answer is to use the Google Geocode API to do a request for the user's input and see if I get any results.) However the geocode ToS forbids this: ...the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map

Haversine calculation: Show users within set [closed]

怎甘沉沦 提交于 2019-12-11 10:17:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Building a carpooling app for my local community built on PHP and SQL. While I'm usually ofay with php coding, I'm stumped looking for the mathematical formula needed to list: Top 5 nearby users, ordered from closest to furthest given the long / lat of the primary user Limited to those within 500 meters of the

Getting location via a web application being run in a WebView

Deadly 提交于 2019-12-11 10:10:01
问题 m.google.com somehow requests the current location when loaded in Android's browser. I want to do the same thing from a web page being loaded into a WebView in my own application. Is the only way to go about this with WebView.addJavascriptInterface() , or is there already a javascript interface available for webapps to use? 回答1: It's done via HTML5. Lookup here the Javascript: http://dev.w3.org/geo/api/spec-source.html 来源: https://stackoverflow.com/questions/2511195/getting-location-via-a-web