Forum > General

[SOLVED] "Close to track" detection with lat/long coordinates

(1/3) > >>

This continues the discussion of determining whether a point is within a given perimeter at,65082.msg495816.html#msg495816

Given two relatively-close points described by lat/long coordinates, believed to be good to around a second of arc, is there a way which is both readable and moderately accurate to determine whether a third point is within some distance (say 50m) either side of the line between them (/which/ side doesn't matter)?

The number of lines to be handled in this way is fairly small, so it would be feasible to precompute the offsets (in arcsecs) perpendicular to each which corresponded to the distance of interest. Or in extremis, it would be possible to expand each line to a rectangle and apply the algorithms discussed in the link above.


This is a geometry problem. You can take latitude as the Y axis and longitude as the X axis. Then the problem is reduced to calculating the distance of a given point (x,y) with respect to the line that passes through (x1,y1) and (x2,y2) .

Capture from

Yes, but that assumes that the ordinate scales are equal: which isn't the case for geographic coordinates in most parts of the World.

With the coordinates given as lat/long, you need to work out the orientation of the original line (or, equivalently, the perpendicular): and then use that to resolve and re-scale the perpendicular distance to metres. I'm sure there's shortcuts for doing that.


I think that for small distances, the differences would be negligible. For longer distances, a coefficient based on latitude would possibly be needed. For example:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---distance := distance(x0,y0) * (1 + k * (lat0-lat2))
or something like that (k would depend on the inclination of the line and the distance between P1 and P2).


[0] Message Index

[#] Next page

Go to full version