def test_saving_to_disc_index_linestring(self):
     from tests.properties.linestring_properties import input_location, splitter, num_partitions
     linestring_rdd = LineStringRDD(self.sc, input_location, splitter, True,
                                    num_partitions,
                                    StorageLevel.MEMORY_ONLY)
     linestring_rdd.buildIndex(IndexType.RTREE, False)
     linestring_rdd.indexedRawRDD.saveAsObjectFile(
         os.path.join(disc_location, "line_string_index"))
Exemplo n.º 2
0
 def test_spatial_knn_query_using_index(self):
     line_string_rdd = LineStringRDD(self.sc, input_location, splitter,
                                     True)
     line_string_rdd.buildIndex(IndexType.RTREE, False)
     for i in range(self.loop_times):
         result = KNNQuery.SpatialKnnQuery(line_string_rdd,
                                           self.query_point, 5, False)
         assert result.__len__() > -1
         assert result[0].getUserData() is not None
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    def test_spatial_range_query_using_index(self):
        spatial_rdd = LineStringRDD(
            self.sc, input_location, splitter, True, StorageLevel.MEMORY_ONLY
        )
        spatial_rdd.buildIndex(IndexType.RTREE, False)

        for i in range(self.loop_times):
            result_size = RangeQuery.SpatialRangeQuery(spatial_rdd, self.query_envelope, False, False).count()
            assert result_size == 999

        assert RangeQuery.SpatialRangeQuery(
            spatial_rdd, self.query_envelope, False, False).take(10)[1].getUserData() is not None
Exemplo n.º 5
0
    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()