Beispiel #1
0
    def test_to_spatial_rdd_df(self):
        spatial_df = self._create_spatial_point_table()

        spatial_rdd = Adapter.toSpatialRdd(spatial_df)

        spatial_rdd.analyze()

        assert spatial_rdd.approximateTotalCount == 121960
        assert spatial_rdd.boundaryEnvelope == Envelope(-179.147236, 179.475569, -14.548699, 71.35513400000001)
 def test_read_to_point_rdd_multipoint(self):
     input_location = os.path.join(tests_path, "resources/shapefiles/multipoint")
     spatial_rdd = ShapefileReader.readToPointRDD(self.sc, input_location)
     geometry_rdd = ShapefileReader.readToGeometryRDD(self.sc, input_location)
     window = Envelope(-180.0, 180.0, -90.0, 90.0)
     count = RangeQuery.SpatialRangeQuery(spatial_rdd, window, False, False).count()
     assert spatial_rdd.rawSpatialRDD.count() == count
     assert 'org.datasyslab.geospark.spatialRDD.SpatialRDD' in geometry_rdd._srdd.toString()
     assert 'org.datasyslab.geospark.spatialRDD.PointRDD' in spatial_rdd._srdd.toString()
Beispiel #3
0
    def test_to_rdd_from_dataframe(self):
        spatial_df = self._create_spatial_point_table()

        spatial_df.show()

        jsrdd = Adapter.toRdd(spatial_df)

        spatial_rdd = SpatialRDD(self.sc)
        spatial_rdd.rawJvmSpatialRDD = jsrdd
        spatial_rdd.analyze()

        assert spatial_rdd.approximateTotalCount == 121960
        assert spatial_rdd.boundaryEnvelope == Envelope(-179.147236, 179.475569, -14.548699, 71.35513400000001)