Skip to content

Commit

Permalink
Fix bug on downloadin image
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Aug 21, 2023
1 parent 1d6df4a commit 050d20f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import math
import os
import re
from datetime import datetime
from uuid import uuid4
from xml.dom import ValidationErr
Expand Down Expand Up @@ -111,9 +112,14 @@ def get_start_end_download_coords(bbox_coords, zm_level, tile_size):
return start, end


import logging


def download_image(url, base_path, source_name):
response = requests.get(url)
image = response.content
url = re.sub(r"\.(png|jpeg)$", "", url)
logging.info(url)

url_splitted_list = url.split("/")
filename = f"{base_path}/{source_name}-{url_splitted_list[-2]}-{url_splitted_list[-1]}-{url_splitted_list[-3]}.png"
Expand Down

0 comments on commit 050d20f

Please sign in to comment.