name and a globally-unique identifier (gid).
"""
-from optparse import OptionParser
import os
import pgdb
import site
# Needed for the imports that follow.
site.addsitedir(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../src')
+import CLI
import Configuration.Defaults
import ExitCodes
import KML
are provided for the database information and the output is written
to stdout.
"""
-# -h (help) Conflicts with -h HOSTNAME
-parser = OptionParser(add_help_option = False)
-# Use this module's docstring as the description.
-parser.description = __doc__.strip()
-
-parser.add_option('-h',
- '--host',
- help='The hostname/address where the database is located.',
- default=Configuration.Defaults.DATABASE_HOST)
+parser = CLI.default_option_parser()
-parser.add_option('-d',
- '--database',
- help='The database in which the population data are stored.',
- default=Configuration.Defaults.DATABASE_NAME)
-
-parser.add_option('-U',
- '--username',
- help='The username who has access to the database.',
- default=Configuration.Defaults.DATABASE_USERNAME)
+# Use this module's docstring as the description.
+parser.description = __doc__
parser.add_option('-s',
'--state',
statefp = "'%s'" % options.state
lines_query = """
-SELECT gid, tlid, fullname, the_geom
+SELECT gid, tlid, fullname, ST_AsKml(the_geom)
FROM tiger_lines
WHERE statefp=%s
""" % statefp
# Some streets don't have a fullname.
fullname = 'Unknown'
- name = KML.Name(fullname + '(' + str(row[1]) + ')')
+ name = KML.Name(fullname + ' (' + str(row[1]) + ')')
placemark.children.append(name)
geometry = KML.RawText(row[3])