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 SummaryFields 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 SummaryConstructors Constructor Description SpatialRDD()
 - 
Method SummaryAll 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- 
approximateTotalCountpublic long approximateTotalCount The total number of records.
 - 
boundaryEnvelopepublic org.locationtech.jts.geom.Envelope boundaryEnvelope The boundary envelope.
 - 
spatialPartitionedRDDpublic org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> spatialPartitionedRDD The spatial partitioned RDD.
 - 
indexedRDDpublic org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRDD The indexed RDD.
 - 
indexedRawRDDpublic org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRawRDD The indexed raw RDD.
 - 
rawSpatialRDDpublic org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> rawSpatialRDD The raw spatial RDD.
 - 
schemapublic org.apache.spark.sql.types.StructType schema 
 - 
CRStransformationprotected boolean CRStransformation The CR stransformation.
 - 
sourceEpsgCodeprotected String sourceEpsgCode The source epsg code.
 - 
targetEpgsgCodeprotected String targetEpgsgCode The target epgsg code.
 
- 
 - 
Method Detail- 
getSampleNumberpublic int getSampleNumber() 
 - 
setSampleNumberpublic void setSampleNumber(int sampleNumber) Sets the sample number.- Parameters:
- sampleNumber- the new sample number
 
 - 
setNeighborSampleNumberpublic void setNeighborSampleNumber(int neighborSampleNumber) Sets the neighbor sample number.- Parameters:
- neighborSampleNumber- the new neighbor sample number
 
 - 
CRSTransformpublic boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient) CRS transform.- Parameters:
- sourceEpsgCRSCode- the source epsg CRS code
- targetEpsgCRSCode- the target epsg CRS code
- lenient- consider the difference of the geodetic datum between the two coordinate systems, if- true, never throw an exception "Bursa-Wolf Parameters Required", but not recommended for careful analysis work
- Returns:
- true, if successful
 
 - 
CRSTransformpublic boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode) CRS transform.- Parameters:
- sourceEpsgCRSCode- the source epsg CRS code
- targetEpsgCRSCode- the target epsg CRS code
- Returns:
- true, if successful
 
 - 
spatialPartitioningpublic boolean spatialPartitioning(GridType gridType) throws Exception - Throws:
- Exception
 
 - 
spatialPartitioningWithoutDuplicatespublic boolean spatialPartitioningWithoutDuplicates(GridType gridType) throws Exception - Throws:
- Exception
 
 - 
spatialPartitioningWithoutDuplicatespublic 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 GridType
- numPartitions- The target number of partitions
- Throws:
- Exception
 
 - 
spatialPartitioningWithoutDuplicatespublic 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
 
 - 
spatialPartitioningWithoutDuplicatespublic 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_partitionerpublic void calc_partitioner(GridType gridType, int numPartitions) throws Exception Spatial partitioning.- Parameters:
- gridType- the grid type
- numPartitions- the target number of partitions
- Throws:
- Exception- the exception
 
 - 
spatialPartitioningpublic void spatialPartitioning(GridType gridType, int numPartitions) throws Exception - Throws:
- Exception
 
 - 
getPartitionerpublic SpatialPartitioner getPartitioner() 
 - 
spatialPartitioningpublic void spatialPartitioning(SpatialPartitioner partitioner) 
 - 
spatialPartitioningpublic boolean spatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)- Throws:
- Exception
 
 - 
spatialPartitioningpublic boolean spatialPartitioning(StandardQuadTree partitionTree) throws Exception Deprecated.Use spatialPartitioning(SpatialPartitioner partitioner)- Throws:
- Exception
 
 - 
countWithoutDuplicatespublic long countWithoutDuplicates() Count without duplicates.- Returns:
- the long
 
 - 
countWithoutDuplicatesSPRDDpublic long countWithoutDuplicatesSPRDD() Count without duplicates SPRDD.- Returns:
- the long
 
 - 
buildIndexpublic void buildIndex(IndexType indexType, boolean buildIndexOnSpatialPartitionedRDD) throws Exception Builds the index.- Parameters:
- indexType- the index type
- buildIndexOnSpatialPartitionedRDD- the build index on spatial partitioned RDD
- Throws:
- Exception- the exception
 
 - 
coalesceAndBuildRawIndexpublic 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
 
 - 
boundarypublic org.locationtech.jts.geom.Envelope boundary() Deprecated.Call analyze() insteadBoundary.- Returns:
- the envelope
 
 - 
getRawSpatialRDDpublic org.apache.spark.api.java.JavaRDD<T> getRawSpatialRDD() Gets the raw spatial RDD.- Returns:
- the raw spatial RDD
 
 - 
setRawSpatialRDDpublic void setRawSpatialRDD(org.apache.spark.api.java.JavaRDD<T> rawSpatialRDD) Sets the raw spatial RDD.- Parameters:
- rawSpatialRDD- the new raw spatial RDD
 
 - 
analyzepublic boolean analyze(org.apache.spark.storage.StorageLevel newLevel) Analyze.- Parameters:
- newLevel- the new level
- Returns:
- true, if successful
 
 - 
analyzepublic boolean analyze() Analyze.- Returns:
- true, if successful
 
 - 
analyzepublic boolean analyze(org.locationtech.jts.geom.Envelope datasetBoundary, Integer approximateTotalCount)
 - 
saveAsWKBpublic void saveAsWKB(String outputLocation) Save as WKB.- Parameters:
- outputLocation- the output location
 
 - 
saveAsWKTpublic void saveAsWKT(String outputLocation) Save as WKT
 - 
saveAsGeoJSONpublic 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
 
 - 
getCRStransformationpublic boolean getCRStransformation() Gets the CR stransformation.- Returns:
- the CR stransformation
 
 - 
getSourceEpsgCodepublic String getSourceEpsgCode() Gets the source epsg code.- Returns:
- the source epsg code
 
 - 
getTargetEpgsgCodepublic String getTargetEpgsgCode() Gets the target epgsg code.- Returns:
- the target epgsg code
 
 - 
flipCoordinatespublic void flipCoordinates() 
 
- 
 
-