public class SpatialRDD<T extends org.locationtech.jts.geom.Geometry> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
long |
approximateTotalCount
The total number of records.
|
org.locationtech.jts.geom.Envelope |
boundaryEnvelope
The boundary envelope.
|
protected boolean |
CRStransformation
The CR stransformation.
|
List<String> |
fieldNames |
org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> |
indexedRawRDD
The indexed raw RDD.
|
org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> |
indexedRDD
The indexed RDD.
|
org.apache.spark.api.java.JavaRDD<T> |
rawSpatialRDD
The raw spatial RDD.
|
org.apache.spark.sql.types.StructType |
schema |
protected String |
sourceEpsgCode
The source epsg code.
|
org.apache.spark.api.java.JavaRDD<T> |
spatialPartitionedRDD
The spatial partitioned RDD.
|
protected String |
targetEpgsgCode
The target epgsg code.
|
Constructor and Description |
---|
SpatialRDD() |
Modifier and Type | Method and Description |
---|---|
boolean |
analyze()
Analyze.
|
boolean |
analyze(org.locationtech.jts.geom.Envelope datasetBoundary,
Integer approximateTotalCount) |
boolean |
analyze(org.apache.spark.storage.StorageLevel newLevel)
Analyze.
|
org.locationtech.jts.geom.Envelope |
boundary()
Deprecated.
Call analyze() instead
|
void |
buildIndex(IndexType indexType,
boolean buildIndexOnSpatialPartitionedRDD)
Builds the index.
|
void |
calc_partitioner(GridType gridType,
int numPartitions)
Spatial partitioning.
|
STRtree |
coalesceAndBuildRawIndex(IndexType indexType)
Builds the index on coalesced raw spatial RDD.
|
long |
countWithoutDuplicates()
Count without duplicates.
|
long |
countWithoutDuplicatesSPRDD()
Count without duplicates SPRDD.
|
boolean |
CRSTransform(String sourceEpsgCRSCode,
String targetEpsgCRSCode)
CRS transform.
|
boolean |
CRSTransform(String sourceEpsgCRSCode,
String targetEpsgCRSCode,
boolean lenient)
CRS transform.
|
void |
flipCoordinates() |
boolean |
getCRStransformation()
Gets the CR stransformation.
|
SpatialPartitioner |
getPartitioner() |
org.apache.spark.api.java.JavaRDD<T> |
getRawSpatialRDD()
Gets the raw spatial RDD.
|
int |
getSampleNumber() |
String |
getSourceEpsgCode()
Gets the source epsg code.
|
String |
getTargetEpgsgCode()
Gets the target epgsg code.
|
RectangleRDD |
MinimumBoundingRectangle()
Deprecated.
|
void |
saveAsGeoJSON(String outputLocation)
Save as geo JSON.
|
void |
saveAsWKB(String outputLocation)
Save as WKB.
|
void |
saveAsWKT(String outputLocation)
Save as WKT
|
void |
setNeighborSampleNumber(int neighborSampleNumber)
Sets the neighbor sample number.
|
void |
setRawSpatialRDD(org.apache.spark.api.java.JavaRDD<T> rawSpatialRDD)
Sets the raw spatial RDD.
|
void |
setSampleNumber(int sampleNumber)
Sets the sample number.
|
boolean |
spatialPartitioning(GridType gridType) |
void |
spatialPartitioning(GridType gridType,
int numPartitions) |
boolean |
spatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids)
Deprecated.
Use spatialPartitioning(SpatialPartitioner partitioner)
|
void |
spatialPartitioning(SpatialPartitioner partitioner) |
boolean |
spatialPartitioning(StandardQuadTree partitionTree)
Deprecated.
Use spatialPartitioning(SpatialPartitioner partitioner)
|
boolean |
spatialPartitioningWithoutDuplicates(GridType gridType) |
void |
spatialPartitioningWithoutDuplicates(GridType gridType,
int numPartitions)
Calculate non-duplicate inducing partitioning
|
boolean |
spatialPartitioningWithoutDuplicates(List<org.locationtech.jts.geom.Envelope> otherGrids)
Calculate non-duplicate inducing partitioning based on a list of existing envelopes
|
void |
spatialPartitioningWithoutDuplicates(SpatialPartitioner partitioner)
Calculate non-duplicate inducing partitioning from an existing SpatialPartitioner
|
public long approximateTotalCount
public org.locationtech.jts.geom.Envelope boundaryEnvelope
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> spatialPartitionedRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRDD
public org.apache.spark.api.java.JavaRDD<org.locationtech.jts.index.SpatialIndex> indexedRawRDD
public org.apache.spark.api.java.JavaRDD<T extends org.locationtech.jts.geom.Geometry> rawSpatialRDD
public org.apache.spark.sql.types.StructType schema
protected boolean CRStransformation
protected String sourceEpsgCode
protected String targetEpgsgCode
public int getSampleNumber()
public void setSampleNumber(int sampleNumber)
sampleNumber
- the new sample numberpublic void setNeighborSampleNumber(int neighborSampleNumber)
neighborSampleNumber
- the new neighbor sample numberpublic boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient)
sourceEpsgCRSCode
- the source epsg CRS codetargetEpsgCRSCode
- the target epsg CRS codelenient
- 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 workpublic boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode)
sourceEpsgCRSCode
- the source epsg CRS codetargetEpsgCRSCode
- the target epsg CRS codepublic boolean spatialPartitioning(GridType gridType) throws Exception
Exception
public boolean spatialPartitioningWithoutDuplicates(GridType gridType) throws Exception
Exception
public void spatialPartitioningWithoutDuplicates(GridType gridType, int numPartitions) throws Exception
Note that non-duplicating partitioners are intended for use by distributed partitioned writers and not able to be used for spatial joins.
gridType
- The target GridTypenumPartitions
- The target number of partitionsException
public void spatialPartitioningWithoutDuplicates(SpatialPartitioner partitioner)
Note that non-duplicating partitioners are intended for use by distributed partitioned writers and not able to be used for spatial joins.
partitioner
- An existing partitioner obtained from the partitioning of another
SpatialRDD.Exception
public boolean spatialPartitioningWithoutDuplicates(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception
This 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.
otherGrids
- A list of existing envelopesException
public void calc_partitioner(GridType gridType, int numPartitions) throws Exception
gridType
- the grid typenumPartitions
- the target number of partitionsException
- the exceptionpublic void spatialPartitioning(GridType gridType, int numPartitions) throws Exception
Exception
public SpatialPartitioner getPartitioner()
public void spatialPartitioning(SpatialPartitioner partitioner)
public boolean spatialPartitioning(List<org.locationtech.jts.geom.Envelope> otherGrids) throws Exception
Exception
public boolean spatialPartitioning(StandardQuadTree partitionTree) throws Exception
Exception
public long countWithoutDuplicates()
public long countWithoutDuplicatesSPRDD()
public void buildIndex(IndexType indexType, boolean buildIndexOnSpatialPartitionedRDD) throws Exception
indexType
- the index typebuildIndexOnSpatialPartitionedRDD
- the build index on spatial partitioned RDDException
- the exceptionpublic STRtree coalesceAndBuildRawIndex(IndexType indexType)
indexType
- the index typeException
- the exceptionpublic org.locationtech.jts.geom.Envelope boundary()
public org.apache.spark.api.java.JavaRDD<T> getRawSpatialRDD()
public void setRawSpatialRDD(org.apache.spark.api.java.JavaRDD<T> rawSpatialRDD)
rawSpatialRDD
- the new raw spatial RDDpublic boolean analyze(org.apache.spark.storage.StorageLevel newLevel)
newLevel
- the new levelpublic boolean analyze()
public boolean analyze(org.locationtech.jts.geom.Envelope datasetBoundary, Integer approximateTotalCount)
public void saveAsWKB(String outputLocation)
outputLocation
- the output locationpublic void saveAsWKT(String outputLocation)
public void saveAsGeoJSON(String outputLocation)
outputLocation
- the output location@Deprecated public RectangleRDD MinimumBoundingRectangle()
public boolean getCRStransformation()
public String getSourceEpsgCode()
public String getTargetEpgsgCode()
public void flipCoordinates()
Copyright © 2025 The Apache Software Foundation. All rights reserved.