distance

Distance matrix for mysql, based on previous solution for haversine distance calculation

拜拜、爱过 提交于 2019-12-11 23:59:10
问题 This question is self-answered to help people that need to create distance matrix in MySQL, which supports queries such as "select id2 from Distances where id1=10 and type1=0 and type2=1 and distance<10" which would find objects of type 1 in vicinity of 10 from object 10 of type 0. The code assumes table structure similar to one described in Mysql Haversine distance calculation If you ever find yourself in need of a distance matrix in mysql, here's a View definition for it: select o1.object

How to add distance to pin of an MKAnnotation?

≡放荡痞女 提交于 2019-12-11 23:21:56
问题 Ive got an app that plots mkannotations (i hope i get my terminology right...its kinda confusing) on a mapview. I have already included the subtitle for when you tap on them. I have been looking online for a way to include the distance in those callouts but im not quite there yet. I ran across two partial solutions and Im wondering if they should be combined. First, I didnt have CoreLocation added to my project, I need it right? To be constantly updating my user location and be able to

displaying accumulated distance gps. convert string/double

ぐ巨炮叔叔 提交于 2019-12-11 19:43:25
问题 my android app function is displaying accumulated distance through gps when the person is walking. the distance value displayed in like null9.55355.9346855.94574547 and increasing by the second. my gos is sensitive location change very fast even though i am not moving my phone. but the main problem is how do i add the value and not make it increase its length. i was thinking of turning the string dist to a Double1 and double2 += valueof double1. then convert double2 to string and display of

Defining a threshold for Distance between two GEO Locations?

偶尔善良 提交于 2019-12-11 18:53:24
问题 I am getting two GEO locations in my application and I have to calculate distance between them and after distance calculation I have to compare that result with the a defined threshold which is in my case 50 meters , how would I define that threshold in float. Also, Currently I my android fone is at the same location, but I always get the calculated distance between my 2 two geolocations determined after an interval to be more than 50 meters. How is it possible? I am taking threshold of 50

Distance between two coordinates in php using haversine

懵懂的女人 提交于 2019-12-11 18:33:25
问题 I've looked around and seen mention of the haversine formula to determine distance between two coordinates (lat1, lng1) and (lat2, lng2). I've implemented this code: function haversineGreatCircleDistance( $latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371000) { // convert from degrees to radians $latFrom = deg2rad($latitudeFrom); $lonFrom = deg2rad($longitudeFrom); $latTo = deg2rad($latitudeTo); $lonTo = deg2rad($longitudeTo); $latDelta = $latTo - $latFrom;

Find the distance between two locations in android? [duplicate]

不羁的心 提交于 2019-12-11 17:51:06
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Distance calculation from my location to destination location in android I am very new to android google maps i want display distance between two places .for that i write the two autocompletedtextview i get the from and to Locations .by using the public String host = "https://maps.googleapis.com"; public String searchPath = "/maps/api/place/autocomplete/json"; public String detailsPath = "/maps/api/place/details

Distance betweeen coordinates Python vs R computation time

感情迁移 提交于 2019-12-11 17:31:26
问题 I am trying to calculate the distance between one point and many others on a WGS84 ellipsoid - not the haversine approximation as explained in other answers. I would like to do it in Python but the computation time is very long with respect to R. My Python script below takes almost 23 seconds while the equivalent one in R takes 0.13 seconds. Any suggestion for speeding up my python code? Python script: import numpy as np import pandas as pd import xarray as xr from geopy.distance import

Distance between bluetooth module and an android device

馋奶兔 提交于 2019-12-11 16:28:17
问题 I'm trying to calculate the distance between and android device and the HC-05 bluetooth module (connected to an arduino module: the MEGA 2560), using an android app created using appinventor. For example I'd like to know if the devices are 4 meters from each other so I can turn on an alarm. After doing some research it seems that is almost imposible to do, it seems that the most that can be done is estimate that distance constantly sensing the RSSI indicator. Is this possible? if not ,what

Equidistant points in a line segment

旧时模样 提交于 2019-12-11 12:36:26
问题 Let assume you have two points (a , b) in a two dimensional plane. Given the two points, what is the best way to find the maximum points on the line segment that are equidistant from each point closest to it with a minimal distant apart. I use C#, but examples in any language would be helpful. List<'points> FindAllPointsInLine(Point start, Point end, int minDistantApart) { // find all points } 回答1: Interpreting the question as: Between point start And point end What is the maximum number of

Java find k closest points to a given 2D point, quickly

有些话、适合烂在心里 提交于 2019-12-11 11:54:56
问题 I function that takes a set of points, checks their distance against a given point and returns an ordered set with the closest points first. In case 2 points have the same distance from the given point, both will be kept, no problem. I use that function to pick the k closest points to any user-given point with 2D coordinates. It's just a matter of picking the first k points from the ordered set. Right now it's something like this, and I guess the distance calculation is called again and again