Пример #1
0
 def get_height_map_for_latitude_and_longitude(
         self, latitude: float, longitude: float) -> HeightMap:
     """Get the HeightMap for the given latitude and longitude"""
     base = RasterBaseCoordinates.from_float(latitude, longitude)
     try:
         return self.height_maps[base]
     except KeyError:
         raise Exception(
             f"Height map for {base} not found. Have you called "
             f"build_file_index() on your heightmap collection?")
 def get_height_map_for_latitude_and_longitude(
         self, latitude: float, longitude: float) -> HeightMap:
     """Get the HeightMap for the given latitude and longitude"""
     base = RasterBaseCoordinates.from_float(latitude, longitude)
     try:
         return self.height_maps[base]
     except KeyError:
         raise NoHeightMapDataException(
             f"Height map for {base} not found. Either your the SRTM directory "
             f"'{self.hgt_dir}' is missing files, or you have set auto_build_index=False "
             f"and therefore need to manually call build_file_index(). It is probably "
             f"the former.")
Пример #3
0
def test_raster_base_coordinates_zero():
    assert (RasterBaseCoordinates.from_float(
        latitude=0.1,
        longitude=0.1,
    ).file_name == "N00E000")
Пример #4
0
def test_raster_base_coordinates_ne():
    assert (RasterBaseCoordinates.from_float(
        latitude=40.1,
        longitude=5.1,
    ).file_name == "N40E005")
Пример #5
0
def test_raster_base_coordinates_sw():
    assert (RasterBaseCoordinates.from_float(
        latitude=-7.956037,
        longitude=-14.357948,
    ).file_name == "S08W015")
Пример #6
0
def test_raster_base_coordinates_se():
    assert (RasterBaseCoordinates.from_float(
        latitude=-33.768549,
        longitude=18.504695,
    ).file_name == "S34E018")
Пример #7
0
def test_raster_base_coordinates_nw():
    assert (RasterBaseCoordinates.from_float(
        latitude=40.1,
        longitude=-7.1,
    ).file_name == "N40W008")