Skip to content

Commit

Permalink
fix: create the tmp file function missing
Browse files Browse the repository at this point in the history
  • Loading branch information
AngRodrigues committed May 31, 2024
1 parent 6ed00c9 commit 55688fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions map2loop/mapdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,14 @@ def __retrieve_tif(self, filename: str):
Returns:
_type_: The open geotiff in a gdal handler
"""

self.__check_and_create_tmp_path()

# For gdal debugging use exceptions
gdal.UseExceptions()
bb_ll = tuple(self.bounding_box_polygon.to_crs("EPSG:4326").geometry.total_bounds)

if filename.lower() == "aus" or filename.lower() == "au":

url = "http://services.ga.gov.au/gis/services/DEM_SRTM_1Second/MapServer/WCSServer?"
wcs = WebCoverageService(url, version="1.0.0")

Expand All @@ -511,8 +513,9 @@ def __retrieve_tif(self, filename: str):
# This is stupid that gdal cannot read a byte stream and has to have a
# file on the local system to open or otherwise create a gdal file
# from scratch with Create

tmp_file = os.path.join(self.tmp_path, "StupidGDALLocalFile.tif")

with open(tmp_file, "wb") as fh:
fh.write(coverage.read())
tif = gdal.Open(tmp_file)
Expand Down

0 comments on commit 55688fe

Please sign in to comment.