Class TopologicalRelationships

java.lang.Object
org.opengis.cite.geomatics.TopologicalRelationships

public class TopologicalRelationships extends Object
Provides methods to test for the existence of a specified spatial relationship between two geometric objects.
See Also:
  • Constructor Details

    • TopologicalRelationships

      public TopologicalRelationships()
  • Method Details

    • isSpatiallyRelated

      public static boolean isSpatiallyRelated(SpatialOperator predicate, Node node1, Node node2)
      Determines whether or not two GML geometry representations are spatially related in some manner (e.g. g1 contains g2). If the geometry representations have different CRS references, an attempt will be made to change coordinates from one CRS to another through the application of a coordinate operation (conversion or transformation).
      Parameters:
      predicate - A spatial relationship (predicate).
      node1 - An Element node representing a GML geometry object.
      node2 - An Element node representing another GML geometry object.
      Returns:
      true if the geometries satisfy the given spatial relationship ; false otherwise.
    • isWithinDistance

      public static boolean isWithinDistance(Node geom1, Node geom2, Element distanceWithUom)
      Tests whether or not the minimum (orthodromic) distance between two geometry objects is less than the specified distance. That is,
       DWithin(A,B,d) ⇔ Distance(A,B) < d
       

      The computed distance is the shortest distance between the two nearest points in the geometry instances, as measured along the surface of an ellipsoid.

      The unit of measure identifier for the given distance must be either a standard symbol for a unit of length (from UCUM) or an absolute URI that refers to a unit definition (unsupported). SI prefix symbols may also be used (see examples in the table below).

      Units of Length (UCUM)
      Symbol (c/s) Name
      m metre
      km kilometre
      [mi_i] international mile
      [nmi_i] international nautical mile
      Parameters:
      geom1 - An Element node representing a GML geometry instance.
      geom2 - An Element node representing some other GML geometry instance.
      distanceWithUom - An fes:Distance element with a unit of measurement.
      Returns:
      true if the minimum distance between the geometries is less than the given quantity; false otherwise.
      See Also:
    • isBeyond

      public static boolean isBeyond(Node g1, Node g2, Element distanceWithUom)
      Tests whether or not the orthodromic distance between two geometry objects is greater than or equal to the specified distance. That is,
       Beyond(A,B,d) ⇔ Distance(A,B) >= d
       
      Parameters:
      g1 - An Element node representing a GML geometry instance.
      g2 - An Element node representing some other GML geometry instance.
      distanceWithUom - An fes:Distance element with a unit of measurement.
      Returns:
      true if the minimum distance between the geometries equals or exceeds the given quantity; false otherwise.
    • toJTSGeometry

      static Geometry toJTSGeometry(org.geotoolkit.gml.xml.AbstractGeometry gmlGeom)
      Builds a JTS geometry object from a GML geometry object.
      Parameters:
      gmlGeom - A GML geometry.
      Returns:
      A JTS geometry, or null if one could not be constructed.
    • unmarshal

      static org.geotoolkit.gml.xml.AbstractGeometry unmarshal(Node geomNode)
      Creates a GML geometry object from a DOM node.
      Parameters:
      geomNode - A node representing a GML geometry instance.
      Returns:
      A geometry object.
    • setCRS

      Checks that the given geometry object uses the specified CRS. If this is not the case, an attempt is made to change it.
      Parameters:
      g1 - A JTS geometry object.
      crs - The target CRS.
      Returns:
      A Geometry object that uses the indicated CRS (the original geometry if its CRS was unchanged).
      Throws:
      FactoryException - If a CRS cannot be identified (e.g. a missing or invalid reference).
      TransformException - If any coordinate operation (conversion or transformation) fails.