Skip to content

Commit

Permalink
Merge pull request #10 from Kanahiro/fix/url-without-ext
Browse files Browse the repository at this point in the history
Fix/url without ext
  • Loading branch information
Kanahiro authored Oct 22, 2023
2 parents f33c064 + 19af91f commit 257ece9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def _requires_from_file(filename):

setup(
name="tileget",
version="0.2.0",
version="0.2.1",
description="Tile download utility - easily download xyz-tile data",
author="Kanahiro Iguchi",
license="MIT",
Expand Down
7 changes: 5 additions & 2 deletions tileget/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ def main():
geom_3857 = shapely.ops.transform(transformer.transform, geometry)

def download(tile):
ext = args["tileurl"].split(".")[-1]
basepath = args["tileurl"].split("/")[-1] # ?foo=bar&z={z}.ext
segments = basepath.split(".")
ext = "." + segments[-1] if len(segments) > 1 else ""

write_dir = os.path.join(args["output_dir"], str(tile[2]), str(tile[0]))
write_filepath = os.path.join(write_dir, str(tile[1]) + "." + ext)
write_filepath = os.path.join(write_dir, str(tile[1]) + ext)

if os.path.exists(write_filepath) and not args["overwrite"]:
# skip if already exists when not-overwrite mode
Expand Down

0 comments on commit 257ece9

Please sign in to comment.