use of mil.nga.sf.geojson.Polygon in project joa by sebastianfrey.
the class GeoPackageQuery method toPolygon.
private Polygon toPolygon(Bbox bbox) {
Double minX = bbox.getMinX();
Double minY = bbox.getMinY();
// Double minZ = bbox.getMinZ();
Double maxX = bbox.getMaxX();
Double maxY = bbox.getMaxY();
// Double maxZ = bbox.getMaxZ();
Polygon polygon = new Polygon();
Position lowerLeft = new Position(minX, minY);
Position upperLeft = new Position(minX, maxY);
Position upperRight = new Position(maxX, maxY);
Position lowerRight = new Position(maxX, minY);
List<List<Position>> coordinates = List.of(List.of(lowerLeft, upperLeft, upperRight, lowerRight, lowerLeft));
polygon.setCoordinates(coordinates);
return polygon;
}