2

I have a large database of locations, all with lat/long. I use GeoKit and Rails to trivially get locations within a set radius of any other location. All that works great.

My goal is to specify 2 locations (say, A and B), and find all other locations within a radius of Xmi on the path between A and B.

What are some ways in which you could approach this issue? I thought about performing my nearby search at some regular interval on the path, but then I am concerned about performance and the flip-side--missing locations near to the path just because I chose a poor interval.

Thoughts?

RealCasually
  • 3,593
  • 3
  • 27
  • 34

2 Answers2

0

Just Calculate at end points,

At at intervals of radius length along the path

enter image description here

as shown in the diagram.

may this will solve your problem

Mohammad Sadiq Shaikh
  • 3,160
  • 9
  • 35
  • 54
  • Thanks for the answer. However, this falls into my concern over missing areas very close to the path due to poor spacing. For example, if you start on the left and move inwards 25%, a location appearing just ~1 unit away from the path will not be included. We can address this by overlapping areas, but that leads to performance issues. – RealCasually Jan 12 '13 at 08:43
  • 1:Then ypu should take into account the circle condition on end points....2:Write code for checking for rectangle; and check for rectangle of 'width=line width' and 'height=radius' – Mohammad Sadiq Shaikh Jan 12 '13 at 09:29
0

I didn't find an elegant answer here, but sadiqxs was on the right track I suppose. GeoKit doesn't support non-rectangular searches, so I ended up with a solution similar to sadiqxs's but optimized to apply a maximum number of searches based on distance.

RealCasually
  • 3,593
  • 3
  • 27
  • 34