distance

reshape2 melt not producing all pairs

牧云@^-^@ 提交于 2020-01-07 03:48:04
问题 I have a 332 x 332 distance matrix with distances between all possible pairs of stations. I need to transform this matrix into a data.frame with three columns - start.id, end.id, and distance. I have tried the melt function from the reshape2 package but this is not giving the right result Here is a snippet of the data mat 72 79 82 83 116 119 120 127 128 137 143 144 146 147 150 151 152 153 157 160 161 72 NA 6.43 7.458 11.546 3.784 10.252 12.780 4.835 5.230 2.168 10.614 9.806 7.058 6.533 7.117

select restaurant table entries within a certain distance from current location using php

狂风中的少年 提交于 2020-01-06 04:52:09
问题 i have a database table with a list of restaurants including their names, latitudes, and longitudes. i would like to select all the restaurants that are within a certain distance from my current location. the current location is determined in the php file (right now i'm just using a static lat & lng). i found code for calculating the distance: function findDist($lat, $lng){ $currLat = 33.777563; $currLng = -84.389959; $currLat = deg2rad ($currLat); $sincurrLat = sin ($currLat); $lat = deg2rad

Excel distance calculation by using Google Maps API key

和自甴很熟 提交于 2020-01-06 04:43:27
问题 I have been using this for couple of months without a problem. Now I am getting #VALUE in Excel all the time I try get the distance. What can be the problem? I have Google Maps KEY AIzaS.....I Request URL https://maps.googleapis.com/maps/api/distancematrix/xml?origins=$1&destinations=$2&mode=$3&key=$k C8 = London, C9 = Manchester, C10 = Driving Formula in C13: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(gmaps.distance.url;"$1";SUBSTITUTE(C8;" ";"+"));"$2";SUBSTITUTE(C9;" ";"+"));"$3";gmaps

get distance in meters maxscript

倖福魔咒の 提交于 2020-01-06 04:11:19
问题 Is there a way to get distance between two objects in meters? I'm trying this right now units.displayType =#metric myDistance = distance aObject1 aObject2 label1.text = distance as string Of course this is giving me the distance between those objects but in units of 3dsmax... So if anyone knows a way or a formula i will be really grateful thank you 回答1: There is a whole topic in maxscript help dedicated to this, Units Struct - Accessing System and Display Units The piece of code you need

proxy package in R, can't make it work

风流意气都作罢 提交于 2020-01-05 05:40:12
问题 I am wanting to implement an error-weighted euclidean distance function in R (similar but not quite the same as Kumar & Patel. 2005. Rutcor Research Report. RRR 12-2005). I already know that I want to use pr_DB within proxy for this. Here is where I run into problems. The first thing I always do when looking at a new package is cut-and-paste the examples into R to see if they do what I expect them to do. This is not what happened in this case. I started with the simple included example, to

Check if coordinates is within a specific distance from other coordinates

試著忘記壹切 提交于 2020-01-04 17:54:32
问题 Ok, so I have a target on certain coordinates, and some 'persons' on other coordinates, and I want to check if the persons coordinates is within a 2km (2000m) distance from the target coordinates. The code below is just to illustrate what I want more clear, and the question is of course how could this be done? I would really appreciate a solution to this one, thanks! $person0 = Array('56.34342', '49.324523'); $person1 = Array('57.49544', '47.421524'); $person2 = Array('56.74612', '48.722323')

Hierarchical Clustering Large Sparse Distance Matrix R

我只是一个虾纸丫 提交于 2020-01-04 07:56:40
问题 I am attempting to perform fastclust on a very large set of distances, but running into a problem. I have a very large csv file (about 91 million rows so a for loop takes too long in R) of similarities between keywords (about 50,000 unique keywords) that when I read into a data.frame looks like: > df kwd1 kwd2 similarity a b 1 b a 1 c a 2 a c 2 It is a sparse list and I can convert it into a sparse matrix using sparseMatrix(): > myMatrix a b c a . . . b 1 . . c 2 . . However, when I attempt

Calculate distance between two coordinates on a globe

﹥>﹥吖頭↗ 提交于 2020-01-04 01:36:15
问题 I get two coordinate pairs in the form 90°0′0″N 0°0′0″E as string and want to calculate the distance between those points on a sphere with radius R=6371km. I found two formulas on the internet here, the "haversine" and the "spherical law of cosines", but they don't seem to work. For a 90° angle which should return 2*pi*R / 4 , the haversine operates correct but the cosines fail and return 0. A different point with more random coordinates returns false values with both algorithms: the

Calculate min distance between a “line” and one “point”

只谈情不闲聊 提交于 2020-01-03 05:15:09
问题 I have a "linestring" (with init and end points) and a single "point" (two coordinates). And I have implemented the following ActionSctipt code to use "haversine formula" to calculate the distance between two points (each point has x & y coordinates); this function can return the "distance" in "kms", "meters", "feets" or "miles": private function distanceBetweenCoordinates(lat1:Number, lon1:Number, lat2:Number, lon2:Number, units:String = "miles"):Number { var R:int = RADIUS_OF_EARTH_IN_MILES

Finding the distance of object from a logitech camera

℡╲_俬逩灬. 提交于 2020-01-03 05:12:13
问题 I want to find the distance of an object from camera. Note here I am using single camera. Camera autofocuses to focus on planes at particular distance from camera. Is there a way I can find this focus distance? 回答1: I think you are looking for z-direction information even though the image from a camera only gives x-direction and y-direction information. What you have embarked upon is considerably tricky. At your current stage of investigation I would recommend that you go through chapter 4