Exemplo n.º 1
0
def test_srtm3_height_map_collection_load_area():
    collection = Srtm3HeightMapCollection()
    collection.build_file_index()
    collection.load_area(
        RasterBaseCoordinates.from_file_name("N38W006"),
        RasterBaseCoordinates.from_file_name("N40W008"),
    )
    loaded_height_maps = [
        hm for hm in collection.height_maps.values() if hm.raster
    ]
    assert len(loaded_height_maps) == 9
    def build_file_index(self):
        """Load an index of all available files

        This reads file names, but does not load the contained data.
        This is lazy-loaded on demand
        """
        self.height_maps = {}
        for hgt_path in self.hgt_dir.glob("**/*.hgt*"):
            hgt_name = hgt_path.name.split(".")[0]
            self.height_maps[RasterBaseCoordinates.from_file_name(
                hgt_name)] = self.height_map_class(path=hgt_path)
Exemplo n.º 3
0
def test_raster_base_coordinates_from_file_name_sw():
    assert RasterBaseCoordinates.from_file_name("S40W005") == (-40, -5)
Exemplo n.º 4
0
def test_raster_base_coordinates_from_file_name_ne():
    assert RasterBaseCoordinates.from_file_name("N40E005") == (40, 5)