Package org.codice.alliance.libs.klv
Class GeometryUtility
java.lang.Object
org.codice.alliance.libs.klv.GeometryUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringattributeToLineString(ddf.catalog.data.Attribute attribute, GeometryOperator geometryOperator, GeometryOperator.Context geometryOperatorContext) Convert an attribute that contains a list of WKT Points into a WKT.createUnionOfGeometryAttribute(org.locationtech.jts.io.WKTReader wktReader, org.locationtech.jts.io.WKTWriter wktWriter, ddf.catalog.data.Attribute attribute, BiFunction<org.locationtech.jts.geom.Geometry, GeometryOperator.Context, org.locationtech.jts.geom.Geometry> postUnionGeometryOperator, BiFunction<org.locationtech.jts.geom.Geometry, GeometryOperator.Context, org.locationtech.jts.geom.Geometry> preUnionGeometryOperator, GeometryOperator.Context geometryOperatorContext) Create the union of multi-valued attribute that contains WKT.createUnionOfGeometryAttribute(org.locationtech.jts.io.WKTReader wktReader, org.locationtech.jts.io.WKTWriter wktWriter, ddf.catalog.data.Attribute attribute, GeometryOperator.Context geometryOperatorContext) Create the union of multi-valued attribute that contains WKT.static Optional<org.locationtech.jts.geom.Geometry> wktToGeometry(String wkt, org.locationtech.jts.io.WKTReader wktReader)
-
Constructor Details
-
GeometryUtility
public GeometryUtility()
-
-
Method Details
-
createUnionOfGeometryAttribute
public static Optional<String> createUnionOfGeometryAttribute(org.locationtech.jts.io.WKTReader wktReader, org.locationtech.jts.io.WKTWriter wktWriter, ddf.catalog.data.Attribute attribute, GeometryOperator.Context geometryOperatorContext) Create the union of multi-valued attribute that contains WKT. If the union cannot be computed, then this method returnsOptional.empty()- Parameters:
wktReader- non-nullwktWriter- non-nullattribute- non-null- Returns:
- optional wkt string
-
createUnionOfGeometryAttribute
public static Optional<String> createUnionOfGeometryAttribute(org.locationtech.jts.io.WKTReader wktReader, org.locationtech.jts.io.WKTWriter wktWriter, ddf.catalog.data.Attribute attribute, BiFunction<org.locationtech.jts.geom.Geometry, GeometryOperator.Context, org.locationtech.jts.geom.Geometry> postUnionGeometryOperator, BiFunction<org.locationtech.jts.geom.Geometry, GeometryOperator.Context, org.locationtech.jts.geom.Geometry> preUnionGeometryOperator, GeometryOperator.Context geometryOperatorContext) Create the union of multi-valued attribute that contains WKT. If the union cannot be computed, then this method returnsOptional.empty()- Parameters:
wktReader- non-nullwktWriter- non-nullattribute- non-nullpostUnionGeometryOperator- non-null, transform the geometry (e.g. simplify or normalize)preUnionGeometryOperator- non-null, transform the geometry just before the union operation (e.g. reduce precision)- Returns:
- optional wkt string
-
wktToGeometry
-
attributeToLineString
public static String attributeToLineString(ddf.catalog.data.Attribute attribute, GeometryOperator geometryOperator, GeometryOperator.Context geometryOperatorContext) Convert an attribute that contains a list of WKT Points into a WKT. If the attribute does not contain a list of WKT Points, then the results are undefined. If the attribute contains more than one valid WKT Point, then this method will return a WKT LineString. If the attribute contains one valid WKT Point, then this method will return a WKT Point. Otherwise, it will return "LINESTRING EMPTY".- Parameters:
attribute- expected to contain a list of strings, which follow the WKT Point formatgeometryOperator- applied to final geometry before being converted to WKT string- Returns:
- a WKT LineString or Point
-