diff --git a/exfiltrate.py b/exfiltrate.py index af0bc2e..12c5d51 100644 --- a/exfiltrate.py +++ b/exfiltrate.py @@ -11,7 +11,7 @@ from rasterio import Affine from tqdm import tqdm from pkg.image import random_file_width -from pkg.spatial import deg2num, lonlat_to_meters +from pkg.spatial import deg2num from pkg.thread import download_tile if __name__ == '__main__': @@ -102,6 +102,7 @@ if __name__ == '__main__': col_bar.close() print(f'Downloaded {total_downloaded} images.') + print('Preparing data...') tile_size = random_file_width(tiles_output) @@ -144,16 +145,12 @@ if __name__ == '__main__': with ThreadPoolExecutor(max_workers=args.tiff_threads) as executor: futures = {executor.submit(build_tiff_data, task) for task in tiles} - for future in tqdm(as_completed(futures), total=len(futures), desc='Building TIFF'): + for future in tqdm(as_completed(futures), total=len(futures), desc='Preparing Data'): pass # Transpose the image data array to the format (bands, rows, cols). image_data = np.transpose(image_data, (2, 0, 1)) - # Convert geographic coordinates to Web Mercator coordinates. Not 100% sure this is nessesary. - top_left_mx, top_left_my = lonlat_to_meters(top_left_lon, top_left_lat) - bottom_right_mx, bottom_right_my = lonlat_to_meters(bottom_right_lon, bottom_right_lat) - # Define the transformation from pixel coordinates to geographic coordinates, which is an Affine transformation that # maps pixel coordinates in the image to geographic coordinates on the Earth's surface. transform = (Affine.translation(top_left_lon, top_left_lat) # Create a translation transformation that shifts the image and set the origin of the image to the top-left corner of the bounding box.