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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionlongThe total number of records.org.locationtech.jts.geom.EnvelopeThe boundary envelope.protected booleanThe CR stransformation.org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex>The indexed raw RDD.org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex>The indexed RDD.org.apache.spark.api.java.JavaRDD<T>The raw spatial RDD.org.apache.spark.sql.types.StructTypeprotected StringThe source epsg code.org.apache.spark.api.java.JavaRDD<T>The spatial partitioned RDD.protected StringThe target epgsg code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleananalyze()Analyze.booleananalyze(org.apache.spark.storage.StorageLevel newLevel) Analyze.booleanorg.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.longCount without duplicates.longCount without duplicates SPRDD.booleanCRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode) CRS transform.booleanCRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient) CRS transform.voidbooleanGets the CR stransformation.org.apache.spark.api.java.JavaRDD<T>Gets the raw spatial RDD.intGets the source epsg code.Gets the target epgsg code.Deprecated.voidsaveAsGeoJSON(String outputLocation) Save as geo JSON.voidSave as WKB.voidSave 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 Details
-
approximateTotalCount
public long approximateTotalCountThe total number of records. -
boundaryEnvelope
public org.locationtech.jts.geom.Envelope boundaryEnvelopeThe boundary envelope. -
spatialPartitionedRDD
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> spatialPartitionedRDDThe spatial partitioned RDD. -
indexedRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRDDThe indexed RDD. -
indexedRawRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRawRDDThe indexed raw RDD. -
rawSpatialRDD
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> rawSpatialRDDThe raw spatial RDD. -
fieldNames
-
schema
public org.apache.spark.sql.types.StructType schema -
CRStransformation
protected boolean CRStransformationThe CR stransformation. -
sourceEpsgCode
The source epsg code. -
targetEpgsgCode
The target epgsg code.
-
-
Constructor Details
-
SpatialRDD
public SpatialRDD()
-
-
Method Details
-
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
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
CRS transform.- Parameters:
sourceEpsgCRSCode- the source epsg CRS codetargetEpsgCRSCode- the target epsg CRS code- Returns:
- true, if successful
-
spatialPartitioning
- Throws:
Exception
-
spatialPartitioningWithoutDuplicates
- 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
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
Spatial partitioning.- Parameters:
gridType- the grid typenumPartitions- the target number of partitions- Throws:
Exception- the exception
-
spatialPartitioning
- Throws:
Exception
-
getPartitioner
-
spatialPartitioning
-
spatialPartitioning
public boolean spatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)- Throws:
Exception
-
spatialPartitioning
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
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
Gets the raw spatial RDD.- Returns:
- the raw spatial RDD
-
setRawSpatialRDD
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
Save as WKB.- Parameters:
outputLocation- the output location
-
saveAsWKT
Save as WKT -
saveAsGeoJSON
Save as geo JSON.- Parameters:
outputLocation- the output location
-
MinimumBoundingRectangle
Deprecated.Minimum bounding rectangle.- Returns:
- the rectangle RDD
-
getCRStransformation
public boolean getCRStransformation()Gets the CR stransformation.- Returns:
- the CR stransformation
-
getSourceEpsgCode
Gets the source epsg code.- Returns:
- the source epsg code
-
getTargetEpgsgCode
Gets the target epgsg code.- Returns:
- the target epgsg code
-
flipCoordinates
public void flipCoordinates()
-