Class XmlStreamGeometryReader


  • public class XmlStreamGeometryReader
    extends Object
    Parse GML geometries from a StAX XMLStreamReader.
    • Field Detail

      • DEFAULT_CURVE_TOLERANCE

        public static final double DEFAULT_CURVE_TOLERANCE
        See Also:
        Constant Field Values
    • Constructor Detail

      • XmlStreamGeometryReader

        public XmlStreamGeometryReader​(XMLStreamReader reader)
        Create a new instance of the XML Stream Geometry Reader.
        Parameters:
        reader - the reader providing the data to parse
      • XmlStreamGeometryReader

        public XmlStreamGeometryReader​(XMLStreamReader reader,
                                       GeometryFactory geometryFactory)
        Create a new instance of the XML Stream Geometry Reader.
        Parameters:
        reader - the reader providing the data to parse
        geometryFactory - a specific GeometryFactory to use for constructing geometries
      • XmlStreamGeometryReader

        public XmlStreamGeometryReader​(XMLStreamReader reader,
                                       GeometryFactory geometryFactory,
                                       CurvedGeometryFactory curvedGeometryFactory)
        Create a new instance of the XML Stream Geometry Reader.
        Parameters:
        reader - the reader providing the data to parse
        geometryFactory - a specific GeometryFactory to use for constructing geometries
        curvedGeometryFactory - a specific CurvedGeometryFactory to use for constructing curved geometries
    • Method Detail

      • setGeometryFactory

        public void setGeometryFactory​(GeometryFactory geometryFactory)
      • getGeometryFactory

        public GeometryFactory getGeometryFactory()
      • isUnsafeXMLAllowed

        public boolean isUnsafeXMLAllowed()
      • setUnsafeXMLAllowed

        public void setUnsafeXMLAllowed​(boolean unsafeXMLAllowed)
        Parameters:
        unsafeXMLAllowed - true if you want to parse from an XMLStreamReader not configured for safe XML parsing (XMLInputFactory.SUPPORT_DTD is true)
      • setInvertAxisNeeded

        public void setInvertAxisNeeded​(Predicate<CoordinateReferenceSystem> invertAxisNeeded)
        By default axis are not inverted, you can provide a predicate that determines whether axes need to be inverted for a CRS (only called once per CRS).
      • readGeometry

        public Geometry readGeometry()
                              throws NoSuchAuthorityCodeException,
                                     FactoryException,
                                     XMLStreamException,
                                     IOException
        Reads the next Geometry from the stream.

        Precondition: parser cursor positioned on a geometry property (eg. gml:Point, etc).

        Postcondition: parser gets positioned at the end tag of the element it started parsing the geometry at.

        Throws:
        XMLStreamException - when the parser cursor is not positioned on the expected element
        NoSuchAuthorityCodeException - when parsing the EPSG code fails
        FactoryException - when finding an EPSG parser fails
        IOException - unkown error