Class GeometryUtility

java.lang.Object
org.codice.alliance.libs.klv.GeometryUtility

public class GeometryUtility extends Object
  • 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 returns Optional.empty()
      Parameters:
      wktReader - non-null
      wktWriter - non-null
      attribute - 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 returns Optional.empty()
      Parameters:
      wktReader - non-null
      wktWriter - non-null
      attribute - non-null
      postUnionGeometryOperator - 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

      public static Optional<org.locationtech.jts.geom.Geometry> wktToGeometry(String wkt, org.locationtech.jts.io.WKTReader wktReader)
    • 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 format
      geometryOperator - applied to final geometry before being converted to WKT string
      Returns:
      a WKT LineString or Point