Class KmlGeometryUnmarshaller

java.lang.Object
org.opengis.cite.kml22.util.KmlGeometryUnmarshaller

public class KmlGeometryUnmarshaller extends Object
Unmarshals KML 2.x geometry representations (except <Model>) from DOM sources to JTS Geometry objects. The following geometry elements are supported: Point, LineString, LinearRing, Polygon, and MultiGeometry.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an unmarshaller for KML 2.2 geometry elements.
    Constructs an unmarshaller for KML geometry elements in the given target namespace.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) org.locationtech.jts.geom.impl.CoordinateArraySequence
    Builds a raw coordinate sequence from the tuples included in a given coordinates element.
    org.locationtech.jts.geom.Geometry
    Creates a JTS geometry object from a KML 2.x geometry representation.
    (package private) org.locationtech.jts.geom.LinearRing
    Creates a LinearRing geometry object from a source KML2 LinearRing representation.
    (package private) org.locationtech.jts.geom.LineString
    Creates a LineString object from a KML2 LineString representation.
    (package private) org.locationtech.jts.geom.GeometryCollection
    Creates a GeometryCollection geometry object from a source KML2 MultiGeometry representation with one or more geometry members.
    (package private) org.locationtech.jts.geom.Point
    Creates a Point geometry object from a source KML2 Point representation.
    (package private) org.locationtech.jts.geom.Polygon
    Creates a Polygon geometry object from a source KML2 Polygon representation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KmlGeometryUnmarshaller

      public KmlGeometryUnmarshaller()
      Creates an unmarshaller for KML 2.2 geometry elements.
    • KmlGeometryUnmarshaller

      public KmlGeometryUnmarshaller(String namespaceURI)
      Constructs an unmarshaller for KML geometry elements in the given target namespace.
      Parameters:
      namespaceURI - The name of the target namespace (an absolute URI value).
  • Method Details

    • unmarshalKmlGeometry

      public org.locationtech.jts.geom.Geometry unmarshalKmlGeometry(Node node)
      Creates a JTS geometry object from a KML 2.x geometry representation. The provided node must be either an Element or a Document node; if the latter, the geometry must be the document element.
      Parameters:
      node - a DOM Document or Element node representation of a KML 2 geometry element.
      Returns:
      the corresponding JTS Geometry object.
    • unmarshalPoint

      org.locationtech.jts.geom.Point unmarshalPoint(Element geoElem)
      Creates a Point geometry object from a source KML2 Point representation. The ID of the spatial reference system is set to 0 (undefined).
      Parameters:
      geoElem - A DOM Element representing a kml:Point element.
      Returns:
      the corresponding JTS Point object
    • unmarshalLineString

      org.locationtech.jts.geom.LineString unmarshalLineString(Element geoElem)
      Creates a LineString object from a KML2 LineString representation. The ID of the spatial reference system is set to 0 (undefined).
      Parameters:
      geoElem - a DOM Element representing a gml:LineString element.
      Returns:
      the corresponding JTS LineString object
    • unmarshalLinearRing

      org.locationtech.jts.geom.LinearRing unmarshalLinearRing(Element geoElem)
      Creates a LinearRing geometry object from a source KML2 LinearRing representation. The ID of the spatial reference system is set to 0 (undefined).
      Parameters:
      geoElem - a DOM Element representing a kml:LinearRing element.
      Returns:
      the corresponding JTS LinearRing object
    • unmarshalPolygon

      org.locationtech.jts.geom.Polygon unmarshalPolygon(Element geoElem)
      Creates a Polygon geometry object from a source KML2 Polygon representation. The ID of the spatial reference system is set to 0 (undefined).
      Parameters:
      geoElem - a DOM Element representing a kml:Polygon element.
      Returns:
      the corresponding JTS Polygon object.
    • unmarshalMultiGeometry

      org.locationtech.jts.geom.GeometryCollection unmarshalMultiGeometry(Element geoElem)
      Creates a GeometryCollection geometry object from a source KML2 MultiGeometry representation with one or more geometry members.
      Parameters:
      geoElem - a DOM Element representing a kml:MultiGeometry element.
      Returns:
      the corresponding JTS GeometryCollection object
    • buildCoordinateArraySequence

      org.locationtech.jts.geom.impl.CoordinateArraySequence buildCoordinateArraySequence(Node coords)
      Builds a raw coordinate sequence from the tuples included in a given coordinates element. According to the KML reference, coordinates must be specified as a space-separated list of 2D or 3D tuples: lon,lat[,alt]. An IllegalArgumentException is thrown if a coordinate tuple is is not 2D or 3D.
      Parameters:
      coords - a DOM Node representing a kml:coordinates element
      Returns:
      a CoordinateArraySequence that can be used to create primitive geometry objects