java.lang.Object
org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeParser
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MultiPointParser, PointParser, PolygonParser, PolyLineParser

public abstract class ShapeParser extends Object implements Serializable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.locationtech.jts.geom.GeometryFactory
    The geometry factory.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ShapeParser(org.locationtech.jts.geom.GeometryFactory geometryFactory)
    Instantiates a new shape parser.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static boolean
    isNoData(double value)
    According to the shapefile specification, any floating point number smaller than -10^38 is considered a "no data" value.
    abstract org.locationtech.jts.geom.Geometry
    parse the shape to a geometry.
    protected org.locationtech.jts.geom.Coordinate[]
    readCoordinates(ShapeReader reader, int numPoints)
    read numPoints of coordinates from input source.
    protected org.locationtech.jts.geom.Coordinate[]
    readCoordinatesWithM(ShapeReader reader, int numPoints)
    Read coordinates with M values from input source.
    protected org.locationtech.jts.geom.Coordinate[]
    readCoordinatesWithZM(ShapeReader reader, int numPoints)
    Read coordinates with Z and M values from input source.
    protected int[]
    readOffsets(ShapeReader reader, int numParts, int maxOffset)
     

    Methods inherited from class java.lang.Object

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

    • geometryFactory

      protected final org.locationtech.jts.geom.GeometryFactory geometryFactory
      The geometry factory.
  • Constructor Details

    • ShapeParser

      protected ShapeParser(org.locationtech.jts.geom.GeometryFactory geometryFactory)
      Instantiates a new shape parser.
      Parameters:
      geometryFactory - the geometry factory
  • Method Details

    • parseShape

      public abstract org.locationtech.jts.geom.Geometry parseShape(ShapeReader reader)
      parse the shape to a geometry.
      Parameters:
      reader - the reader
      Returns:
      the geometry
    • isNoData

      protected static boolean isNoData(double value)
      According to the shapefile specification, any floating point number smaller than -10^38 is considered a "no data" value. In practice, we also observe that ogrinfo considers 0 as a "no data" value.
      Parameters:
      value - The coordinate value to check
      Returns:
      true if the value is a "no data" value
    • readCoordinates

      protected org.locationtech.jts.geom.Coordinate[] readCoordinates(ShapeReader reader, int numPoints)
      read numPoints of coordinates from input source.
      Parameters:
      reader - the reader
      numPoints - the num points
      Returns:
      the coordinate array
    • readCoordinatesWithZM

      protected org.locationtech.jts.geom.Coordinate[] readCoordinatesWithZM(ShapeReader reader, int numPoints)
      Read coordinates with Z and M values from input source.
      Parameters:
      reader - the reader
      numPoints - the number of points
      Returns:
      the coordinate array with Z and M values
    • readCoordinatesWithM

      protected org.locationtech.jts.geom.Coordinate[] readCoordinatesWithM(ShapeReader reader, int numPoints)
      Read coordinates with M values from input source.
      Parameters:
      reader - the reader
      numPoints - the number of points
      Returns:
      the coordinate array with M values
    • readOffsets

      protected int[] readOffsets(ShapeReader reader, int numParts, int maxOffset)