--- src/org/openstreetmap/josm/gui/layer/GpxLayer.java.orig	2007-11-13 22:31:24.000000000 +0100
+++ src/org/openstreetmap/josm/gui/layer/GpxLayer.java	2007-11-13 22:51:34.000000000 +0100
@@ -43,6 +43,7 @@
 import org.openstreetmap.josm.actions.SaveAction;
 import org.openstreetmap.josm.actions.SaveAsAction;
 import org.openstreetmap.josm.actions.RenameLayerAction;
+import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.gpx.GpxTrack;
 import org.openstreetmap.josm.data.gpx.GpxRoute;
@@ -229,6 +230,7 @@
 		boolean large = Main.pref.getBoolean("draw.rawgps.large");
 
 		Point old = null;
+		LatLon oldlatlon = null;
 		for (GpxTrack trk : data.tracks) {
 			if (!forceLines) {
 				old = null;
@@ -237,13 +239,21 @@
 				for (WayPoint trkPnt : segment) {
 					Point screen = mv.getPoint(trkPnt.eastNorth);
 					if (lines && old != null) {
-						g.drawLine(old.x, old.y, screen.x, screen.y);
+						/* Calculate approximate line distance in meters */
+						double d;
+						d = Math.pow(trkPnt.latlon.lat()-oldlatlon.lat(),2) +
+					    	    Math.pow(Math.cos(Math.toRadians(trkPnt.latlon.lat())),2) * 
+					    	    Math.pow(trkPnt.latlon.lon()-oldlatlon.lon(),2);
+						d = Math.pow(d,0.5) * 111111.1;
+						if(d<100.0)
+							g.drawLine(old.x, old.y, screen.x, screen.y);
 					} else if (!large) {
 						g.drawRect(screen.x, screen.y, 0, 0);
 					}
 					if (large)
 						g.fillRect(screen.x-1, screen.y-1, 3, 3);
 					old = screen;
+					oldlatlon = trkPnt.latlon;
 				}
 			}
 		}
--- src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java.orig	2007-11-13 21:37:49.000000000 +0100
+++ src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java	2007-11-13 22:51:42.000000000 +0100
@@ -244,6 +244,7 @@
 		else
 			g.setColor(Color.GRAY);
 		Point old = null;
+		LatLon oldlatlon = null;
 
 		boolean force = Main.pref.getBoolean("draw.rawgps.lines.force");
 		boolean lines = Main.pref.getBoolean("draw.rawgps.lines");
@@ -256,13 +257,22 @@
 				old = null;
 			for (GpsPoint p : c) {
 				Point screen = mv.getPoint(p.eastNorth);
-				if (lines && old != null)
-					g.drawLine(old.x, old.y, screen.x, screen.y);
+				if (lines && old != null) {
+					/* Calculate approximate line distance in meters */
+					double d;
+					d = Math.pow(p.latlon.lat()-oldlatlon.lat(),2) +
+					    Math.pow(Math.cos(Math.toRadians(p.latlon.lat())),2) * 
+					    Math.pow(p.latlon.lon()-oldlatlon.lon(),2);
+					d = Math.pow(d,0.5) * 111111.1;
+					if(d<100.0)
+						g.drawLine(old.x, old.y, screen.x, screen.y);
+				}
 				else if (!large)
 					g.drawRect(screen.x, screen.y, 0, 0);
 				if (large)
 					g.fillRect(screen.x-1, screen.y-1, 3, 3);
 				old = screen;
+				oldlatlon = p.latlon;
 			}
 		}
 	}
