Index: /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java	(revision 18340)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java	(revision 18341)
@@ -86,4 +86,10 @@
     }
 
+    /**
+     * Check if the coordinates are inside this shape.
+     * @see Polygon#contains(int, int)
+     * @param latlon The latlon to look for
+     * @return {@code true} if the LatLon is inside the shape.
+     */
     public boolean contains(LatLon latlon) {
         return coords.contains(
@@ -115,6 +121,6 @@
 
         coords.addPoint(
-                (int) (lon * LatLon.MAX_SERVER_INV_PRECISION),
-                (int) (lat * LatLon.MAX_SERVER_INV_PRECISION));
+                (int) Math.round((lon * LatLon.MAX_SERVER_INV_PRECISION)),
+                (int) Math.round((lat * LatLon.MAX_SERVER_INV_PRECISION)));
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java	(revision 18340)
+++ /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()));
+    }
 }
