Package org.opengis.cite.kml22.util
Class KmlGeometryUnmarshaller
java.lang.Object
org.opengis.cite.kml22.util.KmlGeometryUnmarshaller
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
ConstructorsConstructorDescriptionCreates an unmarshaller for KML 2.2 geometry elements.KmlGeometryUnmarshaller(String namespaceURI) Constructs an unmarshaller for KML geometry elements in the given target namespace. -
Method Summary
Modifier and TypeMethodDescription(package private) org.locationtech.jts.geom.impl.CoordinateArraySequencebuildCoordinateArraySequence(Node coords) Builds a raw coordinate sequence from the tuples included in a given coordinates element.org.locationtech.jts.geom.GeometryunmarshalKmlGeometry(Node node) Creates a JTS geometry object from a KML 2.x geometry representation.(package private) org.locationtech.jts.geom.LinearRingunmarshalLinearRing(Element geoElem) Creates a LinearRing geometry object from a source KML2 LinearRing representation.(package private) org.locationtech.jts.geom.LineStringunmarshalLineString(Element geoElem) Creates a LineString object from a KML2 LineString representation.(package private) org.locationtech.jts.geom.GeometryCollectionunmarshalMultiGeometry(Element geoElem) Creates a GeometryCollection geometry object from a source KML2 MultiGeometry representation with one or more geometry members.(package private) org.locationtech.jts.geom.PointunmarshalPoint(Element geoElem) Creates a Point geometry object from a source KML2 Point representation.(package private) org.locationtech.jts.geom.PolygonunmarshalPolygon(Element geoElem) Creates a Polygon geometry object from a source KML2 Polygon representation.
-
Constructor Details
-
KmlGeometryUnmarshaller
public KmlGeometryUnmarshaller()Creates an unmarshaller for KML 2.2 geometry elements. -
KmlGeometryUnmarshaller
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
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
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
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
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
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
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
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]. AnIllegalArgumentExceptionis 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
-