Questions tagged [closest-points]

107 questions
3
votes
1 answer

find closest lat long to a input lat long Sql server 2008

Hi I have a point cloud in my database (Sql server 2008 spatial). That is about 6 million records. There are 3 columns: id, value , geom. What is the most optimized way of getting the 'value' at input lat long ?? I am new to spatial queries in SQL…
Shaunak
  • 17,377
  • 5
  • 53
  • 84
3
votes
1 answer

How to find two strings that are close to each other

I have n strings and I want to find the closest pair. What's the fastest practical algorithm to find this pair?
Simd
  • 19,447
  • 42
  • 136
  • 271
3
votes
1 answer

Grouping many points into closest pairs - Python + LP

I have a list which contains a shop_id, latitude, and longitude. Assuming we have an even amount of points, I would like to match each shop to another shop such that our connections are unique and we minimise the overall distance. I was curious if…
mptevsion
  • 937
  • 8
  • 28
3
votes
3 answers

Approximated closest pair algorithm

I have been thinking about a variation of the closest pair problem in which the only available information is the set of distances already calculated (we are not allowed to sort points according to their x-coordinates). Consider 4 points (A, B, C,…
3
votes
1 answer

Dominant set of points in O(n)

So, if two points A(x1,y1) and B(x2,y2) are given, and if x1 <= x2 and y1<= y2, then we say B dominates A. Now, given a lot of points, I wish to find out all the non-dominated points. Trivial approach is compare every point with others and get all…
3
votes
2 answers

Nearest vertex search

I'm looking for effective algorithm to find a vertex nearest to point P(x, y, z). The set of vertices is fixed, each request comes with new point P. I tried kd-tree and others known methods and I've got same problem everywhere: if P is closer then…
3
votes
4 answers

Javascript get nearest hyperlink on a webpage when the mouse is clicked

I am wondering what's the best solution for this. Return and show the nearest hyperlink on a webpage when the mouse is clicked. There are 3 DIVs in this example. each of them carries a hyperlink inside. There's also another hyperlink (hyperlink D)…
peter
  • 8,333
  • 17
  • 71
  • 94
3
votes
3 answers

Intersection Of Two UIViewImages

How can I determine if two uiviewimages intersect. I want to do an auto snap feature. When the small image intersects with the big image or close to it (Lets says the distance<=x), I want the small image automatically snap(connect) to the big image…
2
votes
1 answer

boost::geometry can't recognize that three points are in line (boost::geometry::difference fails)

I have a complex polyline processing using boost::geometry where I need to do boolean operations with them. I got a strange situation, when boost::geometry can't see that 3 points are all in line and fails to subtract a linestring made with 3 points…
Vladimir Shutow
  • 1,028
  • 1
  • 14
  • 22
2
votes
4 answers

Shortest distance pair with points given on a line?

Can someone suggest an algorithm to find out the shortest distance pair of unsorted, colinear points? I've got one solution which does this in O(nlogn) by just doing the closest pair of points in 2D and applying to the line. However, can this be…
Mojo_Jojo
  • 939
  • 4
  • 13
  • 26
2
votes
4 answers

optimize nearest neighbor query on 70 million extremely high density spatial point cloud on SQL Server 2008

I have about 75 million records in a SQL Server 2008 R2 Express database. Each is a lat long corresponding to some value. The table has geography column. I am trying to find one nearest neighbor for a given latitude longitude (point). I already have…
Shaunak
  • 17,377
  • 5
  • 53
  • 84
2
votes
2 answers

Whats fastest way for finding closest number pair in array of pairs

var element_pairs = [[11.333112,22.655543],[35,31231,33.2232],[122352,343421]]; var search_pair = [32,1113,34.5433]; findClosestPair(element_pairs, search_pair); // [35,31231,33.2232] what is the fastest way for find mathematicly closest number…
Utku Cansever
  • 180
  • 2
  • 16
2
votes
1 answer

Closest pair in n dimension

Is there any efficient library function in python to find a pair of points which are closest/farthest? The input is a list of points which lie in a k-dimensional cube of edge size 1. For finding the closest, the following code is taking too much…
Abhishek
  • 551
  • 2
  • 5
  • 22
2
votes
2 answers

Find closest "true" element in 2D boolean matrix?

I have a 2D matrix with boolean values, which is updated highly frequently. I want to choose a 2D index {x, y} within the matrix, and find the nearest element that is "true" in the table, without going through all the elements (the matrix is…
MathuSum Mut
  • 2,765
  • 3
  • 27
  • 59
2
votes
1 answer

How to join two dataframes in pandas using coordinates

I have two dataframes of coordinates archivo1 and archivo2, I need the closest point (id) of the second dataframe in the first one. Until now my code is: import pandas as pd import numpy as np def getDistance(archivo1,lat,log): R = 6371 …