distance

distance between android and iphone

巧了我就是萌 提交于 2019-11-29 22:32:36
问题 I am looking for a way to transmit data when two phones are close by. This needs to be cross platform so I cannot use NFC or iBeacon. I plan on using allJoyn to send information. I would only like to send data to others that are within a few feet of me. Is there any way that I could get an accurate reading of distance on other phones? Or can I get an accurate distance on a master device that could be placed in the room? 回答1: Shot in the dark answer: If both devices are on the same wireless

Google Distance Matrix API Alternatives? [closed]

会有一股神秘感。 提交于 2019-11-29 22:09:34
Can you recommend alternatives for the Google Distance Matrix API? This service is great but has some serious quota limitations and the Terms of use are also pretty tough. Thanks! MapQuest RouteMatrix is pretty much the same thing: http://www.mapquestapi.com/directions/ Bing's Route Data API may be an alternative you can consider - http://msdn.microsoft.com/en-us/library/ff701718.aspx I'm not sure if they have the same functionality, but DeCarta ( http://www.decarta.com/ ) has some nice map API stuff for routing / display. Otherwise you could go for open source stuff like PostGIS with

Find the distance between HTML element and browser (or window) sides

对着背影说爱祢 提交于 2019-11-29 22:06:22
How to find the distance in pixels between html element and one of the browser (or window) sides (left or top) using jQuery? You can use the offset function for that. It gives you the element's position relative to the (left,top) of the document : var offset = $("#target").offset(); display("span is at " + offset.left + "," + offset.top + " of document"); Live example On my browser, that example says that the span we've targeted is at 157,47 (left,top) of the document. This is because I've applied a big padding value to the body element, and used a span with a spacer above it and some text in

Android: compass + distance in a listview

孤者浪人 提交于 2019-11-29 21:58:34
I guess you have all tried "Google Places" in Maps. This is a list of POI close to you. I really would like to do the same feature in my application with a list of GPS coordinates, but that seem really complicated. Making the listview with the distance and the little arrow is very easy, but I cannot understand how to update this list and the arrow everytime the user move his phone. For now I have a static listview. I would like to know if someone succeed to create such a listview. Thank a lot for any information. Reto Meier There are a few options for what you're trying to achieve. Personally,

Physical distance between two places

╄→гoц情女王★ 提交于 2019-11-29 18:31:12
问题 I need to measure the physical distance between two places whose names are provided as strings. Since sometimes the names are written slightly differently, I was looking for a library that could help me measure the difference and then combine it with a measure of the latitude and longitude to select the correct matches. Preferred languages: Java or PHP. Any suggestions? 回答1: Have a look at the Levenshtein distance. This is a way of measuring how different two strings are from one another.

Extract diagonals from a distance matrix in R

北城以北 提交于 2019-11-29 17:39:02
I would like to know how can I extract the values of the first diagonal from a distance matrix. For example: > mymatrix [,1] [,2] [1,] 1 2 [2,] 3 4 [3,] 6 4 [4,] 8 6 > dist(mymatrix) 1 2 3 2 2.828427 3 5.385165 3.000000 4 8.062258 5.385165 2.828427 I want to get in a vector the values: 2.828427, 3.000000, 2.828427 Thanks! One work around is to convert the dist object to matrix and then extract elements where row index is one larger than the column index: mat = as.matrix(dist(mymatrix)) mat[row(mat) == col(mat) + 1] # [1] 2.828427 3.000000 2.828427 A seemingly complicated but extremely

as.matrix on a distance object is extremely slow; how to make it faster?

邮差的信 提交于 2019-11-29 16:34:58
I found an R package Rlof which uses multithreading to calculate distance matrices and it does a wonderful job. However, the output of the function distmc is a vector rather than a matrix. Applying as.matrix to this "dist" object turns out much more expensive than the multi-threaded calculation of distances. Looking at the function help , the options for printing the diagonal and upper triangle are there, but I don't understand where they are supposed to be used. Is there a way of saving the time of as.matrix somehow? Reproducible example: set.seed(42) M1 = matrix(rnorm(15000*20), nrow = 15000

How do I find the difference between two values without knowing which is larger?

馋奶兔 提交于 2019-11-29 13:07:05
I was wondering if there was a function built into Python that can determine the distance between two rational numbers but without me telling it which number is larger. e.g. >>>distance(6,3) 3 >>>distance(3,6) 3 Obviously I could write a simple definition to calculate which is larger and then just do a simple subtraction: def distance(x, y): if x >= y: result = x - y else: result = y - x return result but I'd rather not have to call a custom function like this. From my limited experience I've often found Python has a built in function or a module that does exactly what you want and quicker

Pandas: calculate haversine distance within each group of rows

吃可爱长大的小学妹 提交于 2019-11-29 12:07:49
The sample CSV is like this: user_id lat lon 1 19.111841 72.910729 1 19.111342 72.908387 2 19.111542 72.907387 2 19.137815 72.914085 2 19.119677 72.905081 2 19.129677 72.905081 3 19.319677 72.905081 3 19.120217 72.907121 4 19.420217 72.807121 4 19.520217 73.307121 5 19.319677 72.905081 5 19.419677 72.805081 5 19.629677 72.705081 5 19.111860 72.911347 5 19.111860 72.931346 5 19.219677 72.605081 6 19.319677 72.805082 6 19.419677 72.905086 I know I can use haversine for distance calculation (and python also has haversine package): def haversine(lon1, lat1, lon2, lat2): """ Calculate the great

Wrong distance calculation with MongoDB

天大地大妈咪最大 提交于 2019-11-29 11:11:13
I am executing the following raw query with MongoDB: qry = {"position" : SON([("$near", [52.497309,13.39385]), ("$maxDistance", distance/111.12 )])} locations = Locations.objects(__raw__=qry) The position in the database is set to [52.473266, 13.45494] . I get a result once I set the distance to 7.3 or higher, so it seems the two locations must at least be 7.3 kilometer away from each other. When I calculate the distance of those two geo locations with Google Maps (for example going by car) it's telling me it's only 5.2 kilometer away from each other. I tested it with loads of different