Commit 6b909939 authored by Eliot Blennerhassett's avatar Eliot Blennerhassett add options using docopt

parent d6865cdb
This diff is collapsed.
# Currently python2 because pyspatialite is 2 only
from __future__ import print_function, division, unicode_literals
""" OSM LINZ Address
Usage: [-hl -o DIRECTORY --min-nodes=COUNT --max-nodes=COUNT] [-d DATABASE]
-d DATABASE --database DATABASE spatialite database containing linz_addr table [default: osmlinzaddr.sqlite]
-h --help show this
-o DIRECTORY --output=DIRECTORY Specify output directory. [default: bysuburb]
--min-nodes=COUNT Minimum number of nodes per output file. [default: 1]
--max-nodes=COUNT Maximum number of nodes per output file. [default: 8000]
-l --include-location Include suburb and city tags in output.
from __future__ import print_function, division, unicode_literals
from lxml import etree as ET
from docopt import docopt
import itertools
import os
import pyspatialite.dbapi2 as db
......@@ -27,11 +39,6 @@ def generate_osmchange(dbfile, outdir,
cur = con.cursor()
if False:
q = '''pragma table_info("osm_address")'''
rows = cur.execute(q)
print('osm_address: ',list(rows))
q = '''
......@@ -129,4 +136,11 @@ def generate_osmchange(dbfile, outdir,
if __name__ == '__main__':
generate_osmchange('osmlinzaddr.sqlite', 'bysuburb', min_nodes=4000)
opts = docopt(__doc__, version='osmlinzaddr v0.1')
opts['--min-nodes'] = int(opts['--min-nodes'])
opts['--max-nodes'] = int(opts['--max-nodes'])
if True:
generate_osmchange(opts['--database'], opts['--output'],
min_nodes=opts['--min-nodes'], max_nodes=opts['--max-nodes'],
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment