Skip to content

Commit

Permalink
Add 'dump's parameter — $ mb-util world.mbtiles dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabs committed Jan 2, 2016
1 parent 1d1dca8 commit 3800795
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -35,6 +35,8 @@ Python installation (requires easy_install)
Usage: mb-util [options] input output

Examples:
Export an mbtiles file to a directory of files:
$ mb-util world.mbtiles dumps # when the 2nd argument is "dumps", then dumps the metatdata.json

Export an mbtiles file to a directory of files:
$ mb-util world.mbtiles tiles # tiles must not already exist
Expand Down
12 changes: 10 additions & 2 deletions mb-util
Expand Up @@ -4,6 +4,7 @@
# Supports importing, exporting, and more
#
# (c) Development Seed 2012
# (c) 2016 ePi Rational, Inc.
# Licensed under BSD

import logging, os, sys
Expand All @@ -18,7 +19,10 @@ if __name__ == '__main__':
parser = OptionParser(usage="""usage: %prog [options] input output
Examples:
Export an mbtiles file to a directory of files:
$ mb-util world.mbtiles dumps # when the 2nd argument is "dumps", then dumps the metatdata.json
Export an mbtiles file to a directory of files:
$ mb-util world.mbtiles tiles # tiles must not already exist
Expand Down Expand Up @@ -56,10 +60,14 @@ if __name__ == '__main__':
sys.exit(1)

# to disk
if os.path.isfile(args[0]) and args[1]=="dumps":
mbtiles_file, dumps = args
mbtiles_metadata_to_disk(mbtiles_file, **options.__dict__)
sys.exit(1)

if os.path.isfile(args[0]) and not os.path.exists(args[1]):
mbtiles_file, directory_path = args
mbtiles_to_disk(mbtiles_file, directory_path, **options.__dict__)
mbtiles_metadata_to_disk(mbtiles_file, **options.__dict__)

if os.path.isdir(args[0]) and os.path.isfile(args[1]):
sys.stderr.write('Importing tiles into already-existing MBTiles is not yet supported\n')
Expand Down

0 comments on commit 3800795

Please sign in to comment.