All Questions

Filter by
Sorted by
Tagged with
6 votes
2 answers
9k views

Creating a distance matrix from a list of coordinates in R

I have a csv file with a list of co-ordinate positions for over 2000 farms, with the following structure; FarmID | Latidue | Longitude | ------ |---------|-----------| 1 | y1 | x1 ...
sruby52's user avatar
  • 83
5 votes
5 answers
14k views

Calculating distance between two points in 3D

My assignment is to create main class in which I initialize the value of any point to be at (0,0,0) and to be able to access and mutate all three values (x,y,z) individually. To do this I have used ...
Idan Gelber's user avatar
3 votes
1 answer
6k views

Distance between two sets of points [duplicate]

So after looking at various Questions asked here on stackoverflow I'm still not able to wrap my head around the dist function in R or maybe even a distance matrix in general. So I have two dataframes ...
the_man_in_black's user avatar
3 votes
1 answer
6k views

Calculate overlap between two rectangles on x/y grid?

I need to calculate the overlap (amount or yes/no) that two rectangles make on a special x/y grid. The grid is 500x500 but the sides and corners connect (are continuous). So the next point after 499 ...
Ropstah's user avatar
  • 17.7k
2 votes
4 answers
5k views

Find shortest distance between multiple points

Imagine a small dataset of xy coordinates. These points are grouped by a variable called indexR, there are 3 groups in total. All xy coordinates are in the same units. The data looks approximately ...
Quinn's user avatar
  • 419
2 votes
1 answer
50 views

Calculate distance with multiple starting coordinates

I calculated the travelled distance called distance_m per date with the function points_in_circle for two ID's called HEX_Tag_ID. The coordinates that I put in the function are based on the Datum &...
Pepijn95's user avatar
  • 321
1 vote
4 answers
6k views

Get closest point based on coordinates

I'd like to snap single points to other points based on their distance in R. In detail, I have a bunch of points defined by X and Y coordinate pairs. In addition I have single different points, that I ...
Johannes's user avatar
  • 1,034
1 vote
3 answers
4k views

How can I remove points from a list which are close to points in another list by some distance

I have 2 lists of coordinates of points in an image. Say, List1 = [[2,3],[4,5],[10,20],[45,60]] List2 = [[100,50],[65,48],[58,32],[98,45]...............[655,254],[232,545]] dist = 20 List1 ...
Kushal Khandelwal's user avatar
1 vote
2 answers
388 views

Average xy points with conditional distance

I have xy coordinates of points and I want to make use distance for averaging points. My data is named qq and I obtain the distance matrix using dist function qq X Y 2 4237.5 4411.5 3 ...
Matias Andina's user avatar
1 vote
0 answers
338 views

scipy.spatial.distance.euclidean(x,y) not working to calculate distance

I have a program that is going to generate (nEls number of) line segments - but I do not want the line segments to overlap. To do this, I am generating co-ordinates randomly, and checking if each co-...
S. K. Sid's user avatar
0 votes
2 answers
82 views

How do I build a matrix using two vectors?

So I need to build a matrix of x and y coordinates. I have the x stored in one matrix called vx=0:6000; and y stored in Vy=repmat(300,1,6000);. Values in x are 0,1,2,...,5999,6000. Values in y are ...
belgarion's user avatar
  • 115
0 votes
1 answer
3k views

Calculating the distance between two squares on a grid - Java

I am creating a game in Java and have a grid of squares that make up the playable area. The player has certain targets and I need to work out how far away the player is from those targets using the x ...
user3407039's user avatar
  • 1,315
0 votes
1 answer
2k views

Comparing X Y coordinates of the same list

I have a list of X Y tuple coordinates. I am trying to eliminate the coordinates that are very close to each other using the euclidean distance. However, the code so far does not perform as expected, ...
Aly Abdelaziz's user avatar
0 votes
1 answer
46 views

Calculate distance between multiple coordinates of different ID's

I want to calculate the distance between coordinates (I have them in WGS84 and RD, doesn't matter which one you use). I have a column HEX_Tag_ID with coordinates on different dates Datum. My final ...
Pepijn95's user avatar
  • 321
0 votes
2 answers
51 views

Most efficient way to retrieve data from two lists nested as values of dictionary in python

I have a dictionary of coordinates from structures in three dimensional space with struc_dict = { 'struc1' : [np.array(x,y,z), np.array(x,y,z), np.array(x,y,z), ...], 'struc2' : [np....
KiliBio's user avatar
  • 73
0 votes
1 answer
320 views

Find coordinate of point on a straight line between two points?

How can I code a script in python for the following problem? I have starting and ending coordinates of a straight line. I want to find coordinate of a point with a given distance from the starting ...
Enviro_Hydro's user avatar
0 votes
1 answer
74 views

subset first and last date and calculate euclidean distance

I have a dataset with a column of dates Datum. These dates have coordinates in Longitude and Latitude and belong to an unique ID called HEX_Tag_ID. I want to calculate the distance in meters between ...
Pepijn95's user avatar
  • 321
0 votes
1 answer
561 views

Euclidean distance matrix of two list of coordinates [duplicate]

I am trying to get a matrix that contains the distances between the points in two lists. The vector of points contain the latitude and longitude, and the distance can be calculated between any two ...
AOL's user avatar
  • 1
0 votes
0 answers
45 views

Determination of a given point's closeness to a given set of points [Without using euclidean distance]

I am faced with a problem in which I have to determine weather a random point(Cartesian co-ordinate) is closer in range[euclidean distance] to a set 'N' of points. I cannot use the following methods ...
Arg_Stack's user avatar
0 votes
2 answers
1k views

Nearest Neighbor (distance between coordinate pairs)

I have 2 data sets of cells (each set has multiple rows (individual cells) with x,y coordinates as columns) I want to find the smallest distance for every cell in data set A to any cell in data set B. ...
StevenL's user avatar
  • 99
0 votes
1 answer
1k views

Random moving from coordinates in Javascript

I'm using Javascript to build my humble robot army. // Objet Robot function Robot(nick, pv, maxSpeed, position) { this.nick = nick; this.pv = pv; this.maxSpeed = maxSpeed; this.position = ...
Moody_jr's user avatar
0 votes
2 answers
3k views

Calculating the geographic and euclidean distances for TSP in Java

Basically I'm using data from TSPLIB and I have this spec . This is how I calculated the Euclidean distance (according to the above spec): public static double calculateDistance(double x1, double y1, ...
MTA's user avatar
  • 759
-1 votes
2 answers
438 views

Python - Find the first white pixel and last one in each column

how can i find first and last white pixel in a column of binary image . To i calculate distance between points in image I did but everything is still not resolved , please help me . I have consulted ...
Fianlto's user avatar
-1 votes
1 answer
389 views

Check if coordinates are within a specific area

I used various sources of information to determine the GPS coordinates of a traffic sign, and plotted them using using plotly.express.scatter_mapbox and add_scattermapbox as follows: The orange dot ...
Kpol's user avatar
  • 11