Questions tagged [distance]

Distance is a numerical description of how far apart objects are.

In physics or everyday discussion, distance may refer to a physical length, or an estimation based on other criteria (e.g. "two counties over"). In mathematics, a distance function or metric is a generalization of the concept of physical distance. A metric is a function that behaves according to a specific set of rules, and provides a concrete way of describing what it means for elements of some space to be "close to" or "far away from" each other. Some example distance functions are:

  • Manhattan Distance (between two vectors)
  • Euclidean Distance (between two vectors)
  • Jaccard Distance (between two sets)
  • Hamming Distance (between two binary strings or bit vectors)

In most cases, "distance from A to B" is interchangeable with "distance between B and A".

For a somewhat deeper discussion see wikipedia.

3952 questions
1
vote
1 answer

How to plot a variable with geographic distance in R?

I would like to plot a simple xy graphic being y=variable and x=geographic distance. I have data.frame with my data of interest in separate columns (ex: Species$Latitude, Species&Longitude, Species$Variable). All coordinates are in decimal degrees…
Mohr
  • 323
  • 1
  • 3
  • 9
1
vote
0 answers

Snapping a point on the raster based on condition

I have a raster and some points. I want to snap the points closest to the raster based on some general conditions. library(raster) ##create a diagonal matrix xy = diag(1, 100, 100) # Turn the matrix into a raster rast <- raster(xy) # Give it…
user3978632
  • 283
  • 4
  • 17
1
vote
0 answers

Distance between latitude and longitude in two separate datasets

I would like to look at aid effectiveness, by looking at whether 1) the aid projects are placed were the child mortality is the highest and 2) If a respondents geographical proximity to a project reduces child mortality. I have two datasets.…
1
vote
0 answers

Find the closest or the nearest path in sql

I have a table(table1) consists of 5 columns in this order date | x | y | z | t ... | 10.24 | 12.01 | 6 | 7 ... | 42 | 18 | 12 | 1 and .... This table has 5 million records I have another…
1
vote
3 answers

How to find the shortest distance from the point to the polygon?

Actually the question in the title. There is a table (osm_buildings) in which the addresses of buildings and their polygons are located. And there is a point, and you need to find the nearest polygons to this point. Finding the distances between…
dailysse
  • 25
  • 1
  • 3
1
vote
1 answer

Searching for K minimum distances between points in 3D

I have two disjoint-sets of points in 3D. I need to find the k pair of points with the minimum distances. Each point has (x, y, z) coordinates. Constaints: The solution has to be a serial optimal solution. No multithreading please. Approaches such…
Arjun C
  • 357
  • 3
  • 8
1
vote
1 answer

How to compute a spatial distance matrix from a given value

I've been looking for a way to (efficiently) compute a distance matrix from a target value and an input matrix. If you consider an input array as: [0 0 1 2 5 2 1] [0 0 2 3 5 2 1] [0 1 1 2 5 4 1] [1 1 1 2 5 4 0] Ho do you compute the spatial…
Bibi
  • 53
  • 4
1
vote
1 answer

Finding shortest distance between a point and a line segment

I need to find the shortest distance between a point and a line segment (point defined as x y, line defined using endpoints ax ay and bx by). I have written some code but it doesn't seem to work for some of the parameters. I'm not sure if there's…
1
vote
2 answers

How to synchronize the ground with the rotation of the wheel?

I want to sync the ground with the rotation of a wheel (pull the ground under with the wheel rotation). The wheel has a dynamic diameter. In my example bellow the ground should keep moving to the left if I press the right arrow, but it…
Alqin
  • 1,305
  • 3
  • 16
  • 35
1
vote
1 answer

Assign points to a group based on minimum distance

I am trying to assign points into groupings based on Euclidean distance. For example, in the data below there are three points that represent three different groups (One, Two, Three, the non-green points on the figure). I would like to assign the…
B. Davis
  • 3,391
  • 5
  • 42
  • 78
1
vote
2 answers

Android: How can I record my distance traveled?

I'm wanting to build an application that will tell me how far I've ran. I was thinking I could keep a list of all GPS coordinates in a List and then do distance formula on them in sequential pairs. I'm not sure this is the best way to do this…
daveomcd
  • 6,367
  • 14
  • 83
  • 137
1
vote
1 answer

Distance measurement using Android acceleration sensor

I want to use Android acceleration sensors to measure distances. I modified the code in stackoverflow. Street information is strange. Can you tell me what's wrong? The sensor is activated when the button is pressed and is calculated if the button is…
1
vote
0 answers

R lattice and latticeExtra: how to reduce white margin between Y axis and data lines

I have made some graphics using doubleYscale command from latticeExtra. I'd like to reduce or even completely remove the white space between the vertical axes and coloured area -I mean, I want data lines to start and end immediatly next to axes-. My…
eugemeb
  • 11
  • 1
1
vote
1 answer

Extracting road distance without Google Maps API

Is there a global alternative to Google Maps API related primarily to the extraction of road distances? Say, I have latitude and longitude information for a great number of locations, in which I would like to build a matrix of distances. Google…
John Doe
  • 212
  • 1
  • 9
  • 28
1
vote
0 answers

Record travelled route based on geolocation in Mapbox

Is there a way to calculate the travelled distance in Mapbox? For example: if a user clicks the start button it'll record the travelled path and calculate the distance. I know it's possible to calculate a distance between two geopoints described…
Rover
  • 387
  • 4
  • 14
1 2 3
99
100