geolocation

How can I set my latitude and longitude for debugging the Geolocation API with Google Chrome?

若如初见. 提交于 2019-11-28 07:40:26
For my development system I'd like to be able to set the Geolocation (Lat, Long) in Chrome so that when I'm doing the testing the browser thinks I'm at location X when I really might be at location Y. Does anyone know how to force Google Chrome to use a Lat and Long that I provide as the location? If you're talking about the Geolocation API, you can override the function: navigator.geolocation.getCurrentPosition = function(success, failure) { success({ coords: { latitude: 30, longitude: -105, }, timestamp: Date.now() }); } So when a library calls into the navigator.geolocation

Android The import com.google cannot be resolved

£可爱£侵袭症+ 提交于 2019-11-28 07:33:05
I'm trying to test LocationService example of Android developer as per following link http://developer.android.com/training/location/retrieve-current.html . At that time, error message show me that " The import com.google cannot be resolved " for following 5 lines. I'm really confused how to solve this problem. import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.location.LocationClient; import com.google.android.gms.location

Determine the centroid of multiple points

夙愿已清 提交于 2019-11-28 07:04:53
I'm writing a mapping application that I am writing in python and I need to get the lat/lon centroid of N points. Say I have two locations a.lat = 101 a.lon = 230 b.lat = 146 b.lon = 200 Getting the center of two points is fairly easy using a euclidean formula. I would like to be able to do it for more then two points. Fundamentally I'm looking to do something like http://a.placebetween.us/ where one can enter multiple addresses and find a the spot that is equidistant for everyone. e.James Have a look at the pdf document linked below. It explains how to apply the plane figure algorithm that

radius search by latitude / longitude

偶尔善良 提交于 2019-11-28 06:53:21
I have found a bunch of answers for this question using mysql , but I wasn't able to convert anything into a query ms sql 2008 can use. I have a longitude and latitude column for each row in the database. I am going to have a latitude and longitude for where the user is. I want to be able to find all rows that are within x miles from the user's latitude/longitude. Also when trying to use other queries I found on SO I keep getting the error - 'pow' is not a recognized built-in function name. which is weird , because I'm pretty sure that I have used pow before in sql 2008. Any help with this

Disable payment gateways based on user country geo-ip in Woocommerce

蹲街弑〆低调 提交于 2019-11-28 06:48:21
问题 In my Woocommerce shop I set up the geolocation system, when geolocation identifies any country other than IT I would like to disable payment methods If it is IT (geop-ip), show payment. If all other country (geo-ip), disable payment. 回答1: Woocommerce has already a geolocation Ip feature through WC_Geolocation class, so you don't need any additional plugin. Here is the way to disable payment gateways for all countries except "IT" (Italy) country code, based on costumer geolocated IP country:

LocationClient vs LocationManager

那年仲夏 提交于 2019-11-28 06:46:26
What is the difference between LocationClient and LocationManager . What is the pros and cons between them (like battery, accuracy)? Which is better to use? Naresh R Location Manager was introduced in Android SDK and can be used as a feature of android. Location Client is something that's part of Google Play SDK and is introduced in the recent Google IO 2013. One can understand that since Location Client is the latest, it is more efficient in getting the location with minimal energy(battery drain) with greater accuracy. UPDATE: LocationClient is deprecated. You have to use GoogleApiClient . An

Projecting a point onto a path

余生颓废 提交于 2019-11-28 06:40:06
问题 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? 回答1: I see it like this: p0,p1 are path line segment

Receiving Location even when app is not running in Swift

故事扮演 提交于 2019-11-28 06:39:22
Still very new to Swift. I have come from an Android background where there is BroadcastReceiver that can deliver location info to a service even though the app isn't running. So I was looking for something similar in iOS/Swift and it appears that before this wasn't possible but it may be now. I am developing for iOS 10 but would be great if it was backwards compatible. I found startMonitoringSignificantLocationChanges which I can execute to start delivering location updates, although this raises a few questions. Once I call this and my app is NOT running, are the updates still being sent ?

Android: Using html5 to determine geolocation in webview with javascript api

試著忘記壹切 提交于 2019-11-28 06:35:03
I'm currently having an issue with geolocation in a webview. I have a webapp. I'm currently not using phonegap or any other mobile framework. I've been unsuccessful at getting the built-in html5 geolocation javascript api to work on an application that runs in a webview in an android app. The site works fine otherwise from the chrome browser on android 2.0+ (geolocation supported). I'm compiling against android api version 5. I've read this post already Phonegap's solution of writing a proxy which wraps the built in call and uses the host activity instead is good, but I'd prefer to use the

Bearing from one coordinate to another

て烟熏妆下的殇ゞ 提交于 2019-11-28 06:30:06
I implemented the "bearing" formula from http://www.movable-type.co.uk/scripts/latlong.html . But it seems highly inaccurate - I suspect some mistakes in my implementation. Could you help me with finding it? My code is below: protected static double bearing(double lat1, double lon1, double lat2, double lon2){ double longDiff= lon2-lon1; double y = Math.sin(longDiff)*Math.cos(lat2); double x = Math.cos(lat1)*Math.sin(lat2)-Math.sin(lat1)*Math.cos(lat2)*Math.cos(longDiff); return Math.toDegrees((Math.atan2(y, x))+360)%360; } You just have your parentheses () in the wrong place. You are adding