Class FormatUtils<T extends org.locationtech.jts.geom.Geometry>

java.lang.Object
org.apache.sedona.common.utils.FormatUtils<T>
All Implemented Interfaces:
Serializable

public class FormatUtils<T extends org.locationtech.jts.geom.Geometry> extends Object implements Serializable
This format mapper is isolated on purpose for the sake of sharing across Spark and Flink
See Also:
  • Field Details

    • startOffset

      protected final int startOffset
      The start offset.
    • endOffset

      protected final int endOffset
      The end offset.
    • splitter

      protected final FileDataSplitter splitter
      The splitter.
    • carryInputData

      protected final boolean carryInputData
      The carry input data.
    • otherAttributes

      protected String otherAttributes
      Non-spatial attributes in each input row will be concatenated to a tab separated string
    • geometryType

      protected GeometryType geometryType
    • factory

      protected transient org.locationtech.jts.geom.GeometryFactory factory
      The factory.
    • geoJSONReader

      protected transient GeoJSONReader geoJSONReader
    • wktReader

      protected transient org.locationtech.jts.io.WKTReader wktReader
    • allowTopologicallyInvalidGeometries

      public boolean allowTopologicallyInvalidGeometries
      Allow mapping of invalid geometries.
    • skipSyntacticallyInvalidGeometries

      public boolean skipSyntacticallyInvalidGeometries
      Crash on syntactically invalid geometries or skip them.
  • Constructor Details

    • FormatUtils

      public FormatUtils(int startOffset, int endOffset, FileDataSplitter splitter, boolean carryInputData, GeometryType geometryType)
      Instantiates a new format mapper.
      Parameters:
      startOffset - the start offset
      endOffset - the end offset
      splitter - the splitter
      carryInputData - the carry input data
    • FormatUtils

      public FormatUtils(FileDataSplitter splitter, boolean carryInputData)
      Instantiates a new format mapper. This is extensively used in SedonaSQL.
      Parameters:
      splitter -
      carryInputData -
    • FormatUtils

      public FormatUtils(FileDataSplitter splitter, boolean carryInputData, GeometryType geometryType)
      This format mapper is used in SedonaSQL.
      Parameters:
      splitter -
      carryInputData -
      geometryType -
  • Method Details

    • readGeoJsonPropertyNames

      public static List<String> readGeoJsonPropertyNames(String geoJson)
    • readGeoJSON

      public org.locationtech.jts.geom.Geometry readGeoJSON(String geoJson)
    • readPropertyNames

      public List<String> readPropertyNames(String geoString)
    • readWkt

      public org.locationtech.jts.geom.Geometry readWkt(String line) throws org.locationtech.jts.io.ParseException
      Throws:
      org.locationtech.jts.io.ParseException
    • readWkb

      public org.locationtech.jts.geom.Geometry readWkb(String line) throws org.locationtech.jts.io.ParseException
      Throws:
      org.locationtech.jts.io.ParseException
    • readCoordinates

      public org.locationtech.jts.geom.Coordinate[] readCoordinates(String line)
    • addMultiGeometry

      public <T extends org.locationtech.jts.geom.Geometry> void addMultiGeometry(org.locationtech.jts.geom.GeometryCollection multiGeometry, List<T> result)
    • readGeometry

      public org.locationtech.jts.geom.Geometry readGeometry(String line) throws org.locationtech.jts.io.ParseException
      Throws:
      org.locationtech.jts.io.ParseException
    • addGeometry

      protected void addGeometry(org.locationtech.jts.geom.Geometry geometry, List<T> result)