Class SpatialRDD<T extends org.locationtech.jts.geom.Geometry>
- java.lang.Object
-
- org.apache.sedona.core.spatialRDD.SpatialRDD<T>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CircleRDD,LineStringRDD,PointRDD,PolygonRDD,RectangleRDD
public class SpatialRDD<T extends org.locationtech.jts.geom.Geometry> extends Object implements Serializable
The Class SpatialRDD.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description longapproximateTotalCountThe total number of records.org.locationtech.jts.geom.EnvelopeboundaryEnvelopeThe boundary envelope.protected booleanCRStransformationThe CR stransformation.List<String>fieldNamesorg.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex>indexedRawRDDThe indexed raw RDD.org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex>indexedRDDThe indexed RDD.org.apache.spark.api.java.JavaRDD<T>rawSpatialRDDThe raw spatial RDD.org.apache.spark.sql.types.StructTypeschemaprotected StringsourceEpsgCodeThe source epsg code.org.apache.spark.api.java.JavaRDD<T>spatialPartitionedRDDThe spatial partitioned RDD.protected StringtargetEpgsgCodeThe target epgsg code.
-
Constructor Summary
Constructors Constructor Description SpatialRDD()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleananalyze()Analyze.booleananalyze(org.apache.spark.storage.StorageLevel newLevel)Analyze.booleananalyze(org.locationtech.jts.geom.Envelope datasetBoundary, Integer approximateTotalCount)org.locationtech.jts.geom.Envelopeboundary()Deprecated.Call analyze() insteadvoidbuildIndex(IndexType indexType, boolean buildIndexOnSpatialPartitionedRDD)Builds the index.voidcalc_partitioner(GridType gridType, int numPartitions)Spatial partitioning.org.locationtech.jts.index.strtree.STRtreecoalesceAndBuildRawIndex(IndexType indexType)Builds the index on coalesced raw spatial RDD.longcountWithoutDuplicates()Count without duplicates.longcountWithoutDuplicatesSPRDD()Count without duplicates SPRDD.booleanCRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode)CRS transform.booleanCRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient)CRS transform.voidflipCoordinates()booleangetCRStransformation()Gets the CR stransformation.SpatialPartitionergetPartitioner()org.apache.spark.api.java.JavaRDD<T>getRawSpatialRDD()Gets the raw spatial RDD.intgetSampleNumber()StringgetSourceEpsgCode()Gets the source epsg code.StringgetTargetEpgsgCode()Gets the target epgsg code.RectangleRDDMinimumBoundingRectangle()Deprecated.voidsaveAsGeoJSON(String outputLocation)Save as geo JSON.voidsaveAsWKB(String outputLocation)Save as WKB.voidsaveAsWKT(String outputLocation)Save as WKTvoidsetNeighborSampleNumber(int neighborSampleNumber)Sets the neighbor sample number.voidsetRawSpatialRDD(org.apache.spark.api.java.JavaRDD<T> rawSpatialRDD)Sets the raw spatial RDD.voidsetSampleNumber(int sampleNumber)Sets the sample number.booleanspatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids)Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)booleanspatialPartitioning(GridType gridType)voidspatialPartitioning(GridType gridType, int numPartitions)booleanspatialPartitioning(StandardQuadTree partitionTree)Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)voidspatialPartitioning(SpatialPartitioner partitioner)booleanspatialPartitioningWithoutDuplicates(List<org.locationtech.jts.geom.Envelope> otherGrids)Calculate non-duplicate inducing partitioning based on a list of existing envelopesbooleanspatialPartitioningWithoutDuplicates(GridType gridType)voidspatialPartitioningWithoutDuplicates(GridType gridType, int numPartitions)Calculate non-duplicate inducing partitioningvoidspatialPartitioningWithoutDuplicates(SpatialPartitioner partitioner)Calculate non-duplicate inducing partitioning from an existing SpatialPartitioner
-
-
-
Field Detail
-
approximateTotalCount
public long approximateTotalCount
The total number of records.
-
boundaryEnvelope
public org.locationtech.jts.geom.Envelope boundaryEnvelope
The boundary envelope.
-
spatialPartitionedRDD
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> spatialPartitionedRDD
The spatial partitioned RDD.
-
indexedRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRDD
The indexed RDD.
-
indexedRawRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRawRDD
The indexed raw RDD.
-
rawSpatialRDD
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> rawSpatialRDD
The raw spatial RDD.
-
schema
public org.apache.spark.sql.types.StructType schema
-
CRStransformation
protected boolean CRStransformation
The CR stransformation.
-
sourceEpsgCode
protected String sourceEpsgCode
The source epsg code.
-
targetEpgsgCode
protected String targetEpgsgCode
The target epgsg code.
-
-
Method Detail
-
getSampleNumber
public int getSampleNumber()
-
setSampleNumber
public void setSampleNumber(int sampleNumber)
Sets the sample number.- Parameters:
sampleNumber- the new sample number
-
setNeighborSampleNumber
public void setNeighborSampleNumber(int neighborSampleNumber)
Sets the neighbor sample number.- Parameters:
neighborSampleNumber- the new neighbor sample number
-
CRSTransform
public boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient)
CRS transform.- Parameters:
sourceEpsgCRSCode- the source epsg CRS codetargetEpsgCRSCode- the target epsg CRS codelenient- consider the difference of the geodetic datum between the two coordinate systems, iftrue, never throw an exception "Bursa-Wolf Parameters Required", but not recommended for careful analysis work- Returns:
- true, if successful
-
CRSTransform
public boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode)
CRS transform.- Parameters:
sourceEpsgCRSCode- the source epsg CRS codetargetEpsgCRSCode- the target epsg CRS code- Returns:
- true, if successful
-
spatialPartitioning
public boolean spatialPartitioning(GridType gridType) throws Exception
- Throws:
Exception
-
spatialPartitioningWithoutDuplicates
public boolean spatialPartitioningWithoutDuplicates(GridType gridType) throws Exception
- Throws:
Exception
-
spatialPartitioningWithoutDuplicates
public void spatialPartitioningWithoutDuplicates(GridType gridType, int numPartitions) throws Exception
Calculate non-duplicate inducing partitioningNote that non-duplicating partitioners are intended for use by distributed partitioned writers and not able to be used for spatial joins.
- Parameters:
gridType- The target GridTypenumPartitions- The target number of partitions- Throws:
Exception
-
spatialPartitioningWithoutDuplicates
public void spatialPartitioningWithoutDuplicates(SpatialPartitioner partitioner)
Calculate non-duplicate inducing partitioning from an existing SpatialPartitionerNote that non-duplicating partitioners are intended for use by distributed partitioned writers and not able to be used for spatial joins.
- Parameters:
partitioner- An existing partitioner obtained from the partitioning of another SpatialRDD.- Throws:
Exception
-
spatialPartitioningWithoutDuplicates
public boolean spatialPartitioningWithoutDuplicates(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception
Calculate non-duplicate inducing partitioning based on a list of existing envelopesThis is shorthand for spatialPartitioningWithoutDuplicates(new IndexedGridPartitioner()). Using spatialPartitioningWithoutDuplicates(gridType, numPartitions) is typically more appropriate because it is able to adapt to the content of the partition and is able to produce more consistently balanced partitions.
Note that non-duplicating partitioners are intended for use by distributed partitioned writers and not able to be used for spatial joins.
- Parameters:
otherGrids- A list of existing envelopes- Returns:
- true on success
- Throws:
Exception
-
calc_partitioner
public void calc_partitioner(GridType gridType, int numPartitions) throws Exception
Spatial partitioning.- Parameters:
gridType- the grid typenumPartitions- the target number of partitions- Throws:
Exception- the exception
-
spatialPartitioning
public void spatialPartitioning(GridType gridType, int numPartitions) throws Exception
- Throws:
Exception
-
getPartitioner
public SpatialPartitioner getPartitioner()
-
spatialPartitioning
public void spatialPartitioning(SpatialPartitioner partitioner)
-
spatialPartitioning
public boolean spatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception
Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)- Throws:
Exception
-
spatialPartitioning
public boolean spatialPartitioning(StandardQuadTree partitionTree) throws Exception
Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)- Throws:
Exception
-
countWithoutDuplicates
public long countWithoutDuplicates()
Count without duplicates.- Returns:
- the long
-
countWithoutDuplicatesSPRDD
public long countWithoutDuplicatesSPRDD()
Count without duplicates SPRDD.- Returns:
- the long
-
buildIndex
public void buildIndex(IndexType indexType, boolean buildIndexOnSpatialPartitionedRDD) throws Exception
Builds the index.- Parameters:
indexType- the index typebuildIndexOnSpatialPartitionedRDD- the build index on spatial partitioned RDD- Throws:
Exception- the exception
-
coalesceAndBuildRawIndex
public org.locationtech.jts.index.strtree.STRtree coalesceAndBuildRawIndex(IndexType indexType)
Builds the index on coalesced raw spatial RDD.- Parameters:
indexType- the index type- Throws:
Exception- the exception
-
boundary
public org.locationtech.jts.geom.Envelope boundary()
Deprecated.Call analyze() insteadBoundary.- Returns:
- the envelope
-
getRawSpatialRDD
public org.apache.spark.api.java.JavaRDD<T> getRawSpatialRDD()
Gets the raw spatial RDD.- Returns:
- the raw spatial RDD
-
setRawSpatialRDD
public void setRawSpatialRDD(org.apache.spark.api.java.JavaRDD<T> rawSpatialRDD)
Sets the raw spatial RDD.- Parameters:
rawSpatialRDD- the new raw spatial RDD
-
analyze
public boolean analyze(org.apache.spark.storage.StorageLevel newLevel)
Analyze.- Parameters:
newLevel- the new level- Returns:
- true, if successful
-
analyze
public boolean analyze()
Analyze.- Returns:
- true, if successful
-
analyze
public boolean analyze(org.locationtech.jts.geom.Envelope datasetBoundary, Integer approximateTotalCount)
-
saveAsWKB
public void saveAsWKB(String outputLocation)
Save as WKB.- Parameters:
outputLocation- the output location
-
saveAsWKT
public void saveAsWKT(String outputLocation)
Save as WKT
-
saveAsGeoJSON
public void saveAsGeoJSON(String outputLocation)
Save as geo JSON.- Parameters:
outputLocation- the output location
-
MinimumBoundingRectangle
@Deprecated public RectangleRDD MinimumBoundingRectangle()
Deprecated.Minimum bounding rectangle.- Returns:
- the rectangle RDD
-
getCRStransformation
public boolean getCRStransformation()
Gets the CR stransformation.- Returns:
- the CR stransformation
-
getSourceEpsgCode
public String getSourceEpsgCode()
Gets the source epsg code.- Returns:
- the source epsg code
-
getTargetEpgsgCode
public String getTargetEpgsgCode()
Gets the target epgsg code.- Returns:
- the target epgsg code
-
flipCoordinates
public void flipCoordinates()
-
-