distance

Calculating the distance between points in different data frames

∥☆過路亽.° 提交于 2019-11-27 07:14:05
问题 I am trying to find the distance between points in two different data frames given that they have the same value in one of their columns. I figure the first step is to join or relate the data in the two data frames. For example there is dataframe A and B which both have lat/long information in them and they share the column Name . Note that for a given Name the lat/long information is different in each dataframe. Thats why I want to calculate the distance between them. I envision the final

android google map finding distance

。_饼干妹妹 提交于 2019-11-27 07:11:10
问题 I am trying to find distance between two locations. I have longitudes and latitudes and I can calculate Euclidean distance. But I want to find road distance. I mean, , I want to calculate the distance of the road that I am going on while going to destination from source. In this case how to calculate this? 回答1: The easiest way would be to use the Google Directions API to get the directions, this gives you a list of all the points along the route (and the total distance). Check out : http:/

Efficient (memory-wise) function for repeated distance matrix calculations AND chunking of extra large distance matrices

孤者浪人 提交于 2019-11-27 06:26:22
问题 I wonder if anyone could have a look at the following code and minimal example and suggest improvements - in particular regarding efficiency of the code when working with really large data sets. The function takes a data.frame and splits it by a grouping variable (factor) and then calculates the distance matrix for all the rows in each group. I do not need to keep the distance matrices - only some statistics ie the mean, the histogram .., then they can be discarded. I don't know much about

Visualise distances between texts

*爱你&永不变心* 提交于 2019-11-27 05:44:45
问题 I'm working on a research project for school. I've written some text mining software that analyzes legal texts in a collection and spits out a score that indicates how similar they are. I ran the program to compare each text with every other text, and I have data like this (although with many more points): codeofhammurabi.txt crete.txt 0.570737 codeofhammurabi.txt iraqi.txt 1.13475 codeofhammurabi.txt magnacarta.txt 0.945746 codeofhammurabi.txt us.txt 1.25546 crete.txt iraqi.txt 0.329545

Mahalonobis distance in R, error: system is computationally singular

↘锁芯ラ 提交于 2019-11-27 03:20:42
问题 I'd like to calculate multivariate distance from a set of points to the centroid of those points. Mahalanobis distance seems to be suited for this. However, I get an error (see below). Can anyone tell me why I am getting this error, and if there is a way to work around it? If you download the coordinate data and the associated environmental data, you can run the following code. require(maptools) occ <- readShapeSpatial('occurrences.shp') load('envDat.Rdata') #standardize the data to scale the

Python: speeding up geographic comparison

雨燕双飞 提交于 2019-11-27 02:45:27
问题 I've written some code that includes a nested loop where the inner loop is executed about 1.5 million times. I have a function in this loop that I'm trying to optimize. I've done some work, and got some results, but I need a little input to check if what I'm doing is sensible. Some background: I have two collections of geographic points (latitude, longitude), one relatively small collection and one relatively huge collection. For every point in the small collection, I need to find the closest

R - How to get row & column subscripts of matched elements from a distance matrix

血红的双手。 提交于 2019-11-27 02:12:23
I have an integer vector vec1 and I am generating a distant matrix using dist function. I want to get the coordinates (row and column) of element of certain value in the distance matrix. Essentially I would like to get the pair of elements that are d-distant apart. For example: vec1 <- c(2,3,6,12,17) distMatrix <- dist(vec1) # 1 2 3 4 #2 1 #3 4 3 #4 10 9 6 #5 15 14 11 5 Say, I am interested in pair of elements in the vector that are 5 unit apart. I wanted to get the coordinate1 which are the rows and coordinate2 which are the columns of the distance matrix. In this toy example, I would expect

distance calculations in mysql queries

丶灬走出姿态 提交于 2019-11-27 02:03:22
I have to query a database of thousands of entries and order this by the distance from a specified point. The issue is that each entry has a latitude and longitude and I would need to retrieve each entry to calculate its distance. With a large database, I don't want to retrieve each row, this may take some time. Is there any way to build this into the mysql query so that I only need to retrieve the nearest 15 entries. E.g. `SELECT events.id, caclDistance($latlng, events.location) AS distance FROM events ORDER BY distance LIMIT 0,15` function caclDistance($old, $new){ //Calculates the distance

which data structure is appropriate to query “all points within distance d from point p”

ぃ、小莉子 提交于 2019-11-27 01:10:16
问题 I have a 3D pointcloud and I'd like to efficiently query all points within distance d from an arbitrary point p (which is not necessarily part of the stored pointcloud) The query would look something like Pointcloud getAllPoints(Point p, float d); what accelerationstructure would be appropriate for this? A range-tree seems to be appropriate only for querying rectangular volumes, not sphere volumes (of course I could query the boundingbox of the sphere and then sort out all vertices that have

Finding Cities within 'X' Kilometers (or Miles)

被刻印的时光 ゝ 提交于 2019-11-27 00:31:36
问题 This may or may not be clear, leave me a comment if I am off base, or you need more information. Perhaps there is a solution out there already for what I want in PHP. I am looking for a function that will add or subtract a distance from a longitude OR latitude value. Reason: I have a database with all Latitudes and Longitudes in it and want to form a query to extract all cities within X kilometers (or miles). My query would look something like this... Select * From Cities Where (Longitude >