create filename and check if it exists.

This commit is contained in:
admin 2026-01-29 08:50:59 -08:00
parent 144a80c180
commit ea14aae7ce

View File

@ -107,6 +107,15 @@ parser.add_argument(
action='store_true',
help="verbose mode, log output goes to stderr")
parser.add_argument(
"-O",
"--override-existing",
dest='override-existing',
default=True,
required=False,
action='store_true',
help="verbose mode, log output goes to stderr")
parser.add_argument(
"-c",
"--country",
@ -162,9 +171,19 @@ logging.debug("Region is [{}]".format(args.region))
iso_code = resolver.resolve(args.country)
logging.debug("iso_code for [{}] is [{}]".format(args.country, iso_code))
target_region_name="{}{}{}".format(args.country,
"" if args.region == 'None' else "-",
"" if args.region == 'None' else args.region)
bbox=get_mainland_bbox(args.country, args.region)
logging.debug("BBOX is [{}]".format(bbox))
logging.debug("BBOX for [{}] as tuple is {}".format(target_region_name, bbox))
#ee.Geometry.BBox(w,s,e,n)
b_list = list(bbox)
logging.debug("BBOX as list is {}".format(b_list))
logging.debug("BBOX for [{}] as list is {}".format(target_region_name, b_list))
target_filename = target_region_name + ".png"
if os.path.exists(target_filename):
logging.debug("The file [{}] already exists.".format(target_filename))
else:
logging.debug("The file [{}] does not exist.".format(target_filename))