Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 16314)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 16315)
@@ -366,5 +366,5 @@
     public void visitBoundingBox(BoundingXYVisitor v) {
         for (ImageEntry e : data)
-            v.visit(e.pos.getEastNorth());
+            v.visit(e.pos);
     }
 
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 16314)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 16315)
@@ -979,5 +979,5 @@
 
         if (prevWp != null) {
-            double distance = getDistance(prevWp, curWp);
+            double distance = prevWp.getCoor().greatCircleDistance(curWp.getCoor());
             // This is in km/h, 3.6 * m/s
             if (curDateWp > prevDateWp)
@@ -1154,19 +1154,3 @@
         }
     }
-
-    /** Return the distance in meters between 2 points
-     * Formula and earth radius from : http://en.wikipedia.org/wiki/Great-circle_distance */
-    public double getDistance(WayPoint p1, WayPoint p2) {
-        double p1Lat = p1.getCoor().lat() * Math.PI / 180;
-        double p1Lon = p1.getCoor().lon() * Math.PI / 180;
-        double p2Lat = p2.getCoor().lat() * Math.PI / 180;
-        double p2Lon = p2.getCoor().lon() * Math.PI / 180;
-        double ret = Math.atan2(Math.sqrt(Math.pow(Math.cos(p2Lat) * Math.sin(p2Lon - p1Lon), 2)
-                                          + Math.pow(Math.cos(p1Lat) * Math.sin(p2Lat)
-                                                     - Math.sin(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon), 2)),
-                                Math.sin(p1Lat) * Math.sin(p2Lat)
-                                + Math.cos(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon))
-                     * 6372795; // Earth radius, in meters
-        return ret;
-    }
 }
