[OSM-talk] Delete gpx points in JOSM

Robert (Jamie) Munro rjmunro at arjam.net
Thu Nov 30 14:36:54 GMT 2006


Richard Fairhurst wrote:
> Nick W wrote:
> 
>> I think that's the thing - it would take complex maths to do anything
>> useful with the trace.
> 
> It's not that hard, honest. I think Steve's done it for something in  
> the past. You just need a bit of basic trig - you omit points until  
> the line diverges (say) 2 degrees from the way you're heading, then  
> you change course and start again.
> 
> (The way Illustrator manages to convert straight line paths into  
> simpler beziers, however, is something I'd class as magic but  
> fortunately not something OSM has to worry about.)

I wonder if we could borrow some of the algorithms from things like
AutoTrace? (http://autotrace.sf.net)

I'd be inclined to write an algorithm where you select a way in JOSM, it
then finds all the GPS points that look like they are part of the way
and not part of other segments or ways, and then iteratively tries to
manipulate points in the way so that the total distance^2 of GPS points
from the way is reduced. If it doesn't go below a certain threshold,
then add another point on the way (on the segment with the highest
error). It if goes very low, take some points away (from between the two
segments that are the most straight in line). The thresholds depend on
the number of GPS points (if there are less points, we don't worry about
trying to get too much accuracy).

There's some possibly useful maths here:
http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
http://mathworld.wolfram.com/LeastSquaresFittingPerpendicularOffsets.html

Robert (Jamie) Munro

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20061130/aa1e88fa/attachment.pgp>


More information about the talk mailing list