Search in sources :

Example 1 with Polygon

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;
}
Also used : Position(mil.nga.sf.geojson.Position) ArrayList(java.util.ArrayList) List(java.util.List) Polygon(mil.nga.sf.geojson.Polygon)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Polygon (mil.nga.sf.geojson.Polygon)1 Position (mil.nga.sf.geojson.Position)1