Пример #1
0
 def test_geometry(self):
     expected = (
         utils.Extent((136700, 455795, 136705, 455800), utils.get_sr("EPSG:28992"))
         .as_geometry()
         .ExportToWkt()
     )
     self.assertEqual(expected, self.source.geometry.ExportToWkt())
Пример #2
0
 def test_extent(self):
     expected = (
         utils.Extent((136700, 455795, 136705, 455800), utils.get_sr("EPSG:28992"))
         .transformed(utils.get_sr("EPSG:4326"))
         .bbox
     )
     assert_allclose(self.source.extent, expected, atol=1e-10)
Пример #3
0
 def test_extent_has_repr(self):
     sr = utils.get_sr("EPSG:4326")
     extent = utils.Extent(sr=sr, bbox=(0, 0, 1, 1))
     self.assertTrue(repr(extent))
Пример #4
0
 def test_extent(self):
     sr = utils.get_sr("EPSG:4326")
     extent = utils.Extent(sr=sr, bbox=(0, 0, 1, 1))
     geometry = extent.as_geometry()
     self.assertEqual(str(geometry), "POLYGON ((0 0,1 0,1 1,0 1,0 0))")
     self.assertEqual(str(geometry.GetSpatialReference()), str(sr))
Пример #5
0
 def _get_extent(self):
     bbox = self.geo_transform.get_bbox(
         (0, 0), (self.gdal_dataset.RasterYSize, self.gdal_dataset.RasterXSize)
     )
     return utils.Extent(bbox, utils.get_sr(self.projection))
Пример #6
0
 def _get_extent(self):
     if not self.data.size:
         return
     bbox = self.geo_transform.get_bbox((0, 0), self.data.shape[1:])
     return utils.Extent(bbox, utils.get_sr(self.projection))