def compare_count(self, spatial_rdd: LineStringRDD, envelope: Envelope,
                      count: int):

        spatial_rdd.analyze()

        assert count == spatial_rdd.approximateTotalCount
        assert envelope == spatial_rdd.boundaryEnvelope
    def test_build_index_without_set_grid(self):
        spatial_rdd = LineStringRDD(sparkContext=self.sc,
                                    InputLocation=input_location,
                                    splitter=splitter,
                                    carryInputData=True,
                                    partitions=num_partitions,
                                    newLevel=StorageLevel.MEMORY_ONLY)

        spatial_rdd.analyze()
        spatial_rdd.buildIndex(IndexType.RTREE, False)
    def test_voronoi_spatial_partitioning(self):
        spatial_rdd = LineStringRDD(sparkContext=self.sc,
                                    InputLocation=input_location,
                                    splitter=splitter,
                                    carryInputData=True,
                                    partitions=10,
                                    newLevel=StorageLevel.MEMORY_ONLY)

        spatial_rdd.analyze()
        spatial_rdd.spatialPartitioning(GridType.VORONOI)
        for envelope in spatial_rdd.grids:
            print(envelope)
    def test_empty_constructor(self):
        spatial_rdd = LineStringRDD(sparkContext=self.sc,
                                    InputLocation=input_location,
                                    splitter=splitter,
                                    carryInputData=True,
                                    partitions=num_partitions,
                                    newLevel=StorageLevel.MEMORY_ONLY)

        spatial_rdd.analyze()
        spatial_rdd.spatialPartitioning(grid_type)
        spatial_rdd.buildIndex(IndexType.RTREE, True)
        spatial_rdd_copy = LineStringRDD()
        spatial_rdd_copy.rawJvmSpatialRDD = spatial_rdd.rawJvmSpatialRDD
        spatial_rdd_copy.analyze()