Package org.apache.sedona.common.utils
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 Summary
FieldsModifier and TypeFieldDescriptionbooleanAllow mapping of invalid geometries.protected final booleanThe carry input data.protected final intThe end offset.protected org.locationtech.jts.geom.GeometryFactoryThe factory.protected GeoJSONReaderprotected GeometryTypeprotected StringNon-spatial attributes in each input row will be concatenated to a tab separated stringbooleanCrash on syntactically invalid geometries or skip them.protected final FileDataSplitterThe splitter.protected final intThe start offset.protected org.locationtech.jts.io.WKTReader -
Constructor Summary
ConstructorsConstructorDescriptionFormatUtils(int startOffset, int endOffset, FileDataSplitter splitter, boolean carryInputData, GeometryType geometryType) Instantiates a new format mapper.FormatUtils(FileDataSplitter splitter, boolean carryInputData) Instantiates a new format mapper.FormatUtils(FileDataSplitter splitter, boolean carryInputData, GeometryType geometryType) This format mapper is used in SedonaSQL. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddGeometry(org.locationtech.jts.geom.Geometry geometry, List<T> result) <T extends org.locationtech.jts.geom.Geometry>
voidaddMultiGeometry(org.locationtech.jts.geom.GeometryCollection multiGeometry, List<T> result) org.locationtech.jts.geom.Coordinate[]readCoordinates(String line) org.locationtech.jts.geom.GeometryreadGeoJSON(String geoJson) readGeoJsonPropertyNames(String geoJson) org.locationtech.jts.geom.GeometryreadGeometry(String line) readPropertyNames(String geoString) org.locationtech.jts.geom.Geometryorg.locationtech.jts.geom.Geometry
-
Field Details
-
startOffset
protected final int startOffsetThe start offset. -
endOffset
protected final int endOffsetThe end offset. -
splitter
The splitter. -
carryInputData
protected final boolean carryInputDataThe carry input data. -
otherAttributes
Non-spatial attributes in each input row will be concatenated to a tab separated string -
geometryType
-
factory
protected transient org.locationtech.jts.geom.GeometryFactory factoryThe factory. -
geoJSONReader
-
wktReader
protected transient org.locationtech.jts.io.WKTReader wktReader -
allowTopologicallyInvalidGeometries
public boolean allowTopologicallyInvalidGeometriesAllow mapping of invalid geometries. -
skipSyntacticallyInvalidGeometries
public boolean skipSyntacticallyInvalidGeometriesCrash 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 offsetendOffset- the end offsetsplitter- the splittercarryInputData- the carry input data
-
FormatUtils
Instantiates a new format mapper. This is extensively used in SedonaSQL.- Parameters:
splitter-carryInputData-
-
FormatUtils
This format mapper is used in SedonaSQL.- Parameters:
splitter-carryInputData-geometryType-
-
-
Method Details
-
readGeoJsonPropertyNames
-
readGeoJSON
-
readPropertyNames
-
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
-
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
-