X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=bin%2Fwkt2kml;h=7735bb75d3892ead70f9f5bcdf8a7360ae7379f4;hb=c498de425990074f93306b066a48400739b6d38a;hp=77f888754ab17770e9fd265f2d99ba2ac83d0482;hpb=9a1f0d95adff6a2ee308f417b2788735d88c03b8;p=dead%2Fcensus-tools.git diff --git a/bin/wkt2kml b/bin/wkt2kml index 77f8887..7735bb7 100755 --- a/bin/wkt2kml +++ b/bin/wkt2kml @@ -1,15 +1,13 @@ #!/usr/bin/env python """ -Convert an OGC Well-Known Text[1] string to a Keyhole Markup Language +Convert an OGC Well-Known Text string to a Keyhole Markup Language (KML) file. -""" -""" -We take a Well-Known Text string as input, and optionally a filename -to which to write the output. While we shouldn't technically *need* -access to a PostGIS database to perform this conversion, it makes -everything a lot easier, so we require it. +We take a Well-Known Text[1] string as input, and optionally a +filename to which to write the output. While we shouldn't technically +*need* access to a PostGIS database to perform this conversion, it +makes everything a lot easier, so we require it. There is prior art[2] (written in Perl) should we ever desire to do the conversions correctly, sans-database. @@ -18,7 +16,6 @@ conversions correctly, sans-database. [2] http://search.cpan.org/dist/Geo-Converter-WKT2KML/ """ -from optparse import OptionParser import os import pgdb import site @@ -28,6 +25,7 @@ import sys # 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 GPS @@ -45,26 +43,10 @@ default. The name option is available in case the user would like to e.g. see the object name in Google Earth. """ -# -h (help) Conflicts with -h HOSTNAME -parser = OptionParser(add_help_option = False) +parser = CLI.default_option_parser() # 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.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) +parser.description = __doc__ parser.add_option('-o', '--outfile',