@Test public void testInputPositions() throws IOException, TurfException { Point ptInPoly = Point.fromLngLat(-86.72229766845702, 36.20258997094334); Point ptOutsidePoly = Point.fromLngLat(-86.75079345703125, 36.18527313913089); Feature polyHole = Feature.fromJson(loadJsonFixture(POLY_WITH_HOLE_FIXTURE)); Polygon polygon = (Polygon) polyHole.geometry(); assertTrue(TurfJoins.inside(ptInPoly, polygon)); assertFalse(TurfJoins.inside(ptOutsidePoly, polygon)); }
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);  }