Index: trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java	(revision 18332)
+++ trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java	(revision 18341)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.imagery;
 
+import static org.junit.jupiter.api.Assertions.assertAll;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -7,4 +8,6 @@
 
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 /**
@@ -29,3 +32,24 @@
         assertEquals("47.1,11.1,47.2,11.2,47.3,11.3;47.1,11.1,47.2,11.2,47.3,11.3", Shape.encodeAsString(Arrays.asList(shape, shape)));
     }
+
+    /**
+     * Check double edge cases
+     * @param coordinate the coordinate to check
+     */
+    @ParameterizedTest
+    @ValueSource(doubles = {
+            // The double representation of 0.2575799 * 1e7 is 2575798.9999999995. Directly casting to int will round down.
+            0.2575799,
+            // Check that 2575798.0000000005 is rounded down
+            0.2575798
+    })
+    void testDoubleEdgeCases(final double coordinate) {
+        final Shape shape = new Shape();
+        shape.addPoint(Double.toString(1), Double.toString(coordinate));
+        shape.addPoint(Double.toString(coordinate), Double.toString(1));
+        shape.addPoint(Double.toString(coordinate), Double.toString(coordinate));
+        assertAll("Coordinates are not properly rounded on entry",
+                () -> assertEquals(coordinate, shape.getPoints().get(0).getLon()),
+                () -> assertEquals(coordinate, shape.getPoints().get(1).getLat()));
+    }
 }
