Package org.meteoinfo.jts.io.gml2
Class GMLReader
- java.lang.Object
-
- org.meteoinfo.jts.io.gml2.GMLReader
-
public class GMLReader extends java.lang.ObjectReads a GML2 geometry from an XML fragment into aGeometry.An example of the GML2 format handled is:
The reader ignores namespace prefixes, and disables both the validation and namespace options on the SAXParser. This class requires the presence of a SAX Parser available via the24824.045318333192,38536.15071012041 26157.378651666528,37567.42733944659 26666.666,36000.0 26157.378651666528,34432.57266055341 24824.045318333192,33463.84928987959 23175.954681666804,33463.84928987959 21842.621348333472,34432.57266055341 21333.333,36000.0 21842.621348333472,37567.42733944659 23175.954681666808,38536.15071012041 SAXParserFactory.newInstance()method.A specification of the GML XML format can be found at the OGC web site: http://www.opengeospatial.org/.
It is the caller's responsibility to ensure that the supplied
PrecisionModelmatches the precision of the incoming data. If a lower precision for the data is required, a subsequent process must be run on the data to reduce its precision.To parse and build geometry directly from a SAX stream, see
GMLHandler.- See Also:
GMLHandler
-
-
Constructor Summary
Constructors Constructor Description GMLReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometryread(java.io.Reader reader, GeometryFactory geometryFactory)Reads a GML2 Geometry from aReaderinto a singleGeometryIf a collection of Geometries is found, aGeometryCollectionis returned.Geometryread(java.lang.String gml, GeometryFactory geometryFactory)Reads a GML2 Geometry from a String into a singleGeometryIf a collection of geometries is found, aGeometryCollectionis returned.
-
-
-
Method Detail
-
read
public Geometry read(java.lang.String gml, GeometryFactory geometryFactory) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
Reads a GML2 Geometry from a String into a singleGeometryIf a collection of geometries is found, aGeometryCollectionis returned.- Parameters:
gml- The GML String to parsegeometryFactory- When null, a default will be used.- Returns:
- the resulting JTS Geometry
- Throws:
javax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXException- See Also:
read(Reader, GeometryFactory)
-
read
public Geometry read(java.io.Reader reader, GeometryFactory geometryFactory) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
Reads a GML2 Geometry from aReaderinto a singleGeometryIf a collection of Geometries is found, aGeometryCollectionis returned.- Parameters:
reader- The input sourcegeometryFactory- When null, a default will be used.- Returns:
- The resulting JTS Geometry
- Throws:
org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationException
-
-