@Test public void testMultipolygonWithHole() throws TurfException, IOException { Point ptInHole = Point.fromLngLat(-86.69208526611328, 36.20373274711739); Point ptInPoly = Point.fromLngLat(-86.72229766845702, 36.20258997094334); Point ptInPoly2 = Point.fromLngLat(-86.75079345703125, 36.18527313913089); Point ptOutsidePoly = Point.fromLngLat(-86.75302505493164, 36.23015046460186); Feature multiPolyHole = Feature.fromJson(loadJsonFixture(MULTIPOLY_WITH_HOLE_FIXTURE)); assertFalse(TurfJoins.inside(ptInHole, (MultiPolygon) multiPolyHole.geometry())); assertTrue(TurfJoins.inside(ptInPoly, (MultiPolygon) multiPolyHole.geometry())); assertTrue(TurfJoins.inside(ptInPoly2, (MultiPolygon) multiPolyHole.geometry())); assertFalse(TurfJoins.inside(ptOutsidePoly, (MultiPolygon) multiPolyHole.geometry())); }
public static boolean inside(Point point, Polygon polygon) { List<List<Point>> coordinates = polygon.coordinates(); List<List<List<Point>>> multiCoordinates = new ArrayList<>(); multiCoordinates.add(coordinates); return inside(point, MultiPolygon.fromLngLats(multiCoordinates)); }
TurfJoins { public static boolean inside(Point point, Polygon polygon) { List<List<Point>> coordinates = polygon.coordinates(); List<List<List<Point>>> multiCoordinates = new ArrayList<>(); multiCoordinates.add(coordinates); return inside(point, MultiPolygon.fromLngLats(multiCoordinates)); } }
TurfJoins { public static boolean inside(Point point, Polygon polygon) { List<List<Point>> coordinates = polygon.coordinates(); List<List<List<Point>>> multiCoordinates = new ArrayList<>(); multiCoordinates.add(coordinates); return inside(point, MultiPolygon.fromLngLats(multiCoordinates)); } private  TurfJoins(); }
TurfJoins { public static boolean inside(Point point, Polygon polygon) { List<List<Point>> coordinates = polygon.coordinates(); List<List<List<Point>>> multiCoordinates = new ArrayList<>(); multiCoordinates.add(coordinates); return inside(point, MultiPolygon.fromLngLats(multiCoordinates)); } private  TurfJoins(); static boolean inside(Point point, Polygon polygon); static boolean inside(Point point, MultiPolygon multiPolygon); static FeatureCollection pointsWithinPolygon(FeatureCollection points,
                                                      FeatureCollection polygons); }
TurfJoins { public static boolean inside(Point point, Polygon polygon) { List<List<Point>> coordinates = polygon.coordinates(); List<List<List<Point>>> multiCoordinates = new ArrayList<>(); multiCoordinates.add(coordinates); return inside(point, MultiPolygon.fromLngLats(multiCoordinates)); } private  TurfJoins(); static boolean inside(Point point, Polygon polygon); static boolean inside(Point point, MultiPolygon multiPolygon); static FeatureCollection pointsWithinPolygon(FeatureCollection points,
                                                      FeatureCollection polygons);  }