Skip to content

Commit

Permalink
Merge pull request #49 from citizenfish/main
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
roelderickx committed Feb 29, 2024
2 parents 07440b5 + 759535e commit 2a0c8b2
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
20 changes: 16 additions & 4 deletions README.md
Expand Up @@ -79,10 +79,11 @@ usage: ogr2osm [-h] [--version] [-t TRANSLATION] [--encoding ENCODING]
[--rounding-digits ROUNDINGDIGITS]
[--significant-digits SIGNIFICANTDIGITS]
[--split-ways MAXNODESPERWAY] [--id ID] [--idfile IDFILE]
[--saveid SAVEID] [-o OUTPUT] [-f] [--pbf] [--no-upload-false]
[--never-download] [--never-upload] [--locked] [--add-bounds]
[--suppress-empty-tags] [--max-tag-length MAXTAGLENGTH]
[--add-z-value-tag TAGNAME]
[--saveid SAVEID] [--positive-id] [-o OUTPUT] [-f] [--pbf]
[--no-upload-false] [--never-download] [--never-upload]
[--locked] [--add-bounds] [--suppress-empty-tags]
[--max-tag-length MAXTAGLENGTH] [--add-z-value-tag TAGNAME]
[--add-version] [--add-timestamp]
DATASOURCE

positional arguments:
Expand Down Expand Up @@ -123,6 +124,8 @@ options:
Defaults to 0.
--idfile IDFILE Read ID to start counting from from a file.
--saveid SAVEID Save last ID after execution to a file.
--positive-id Cause ID to increment. Use with care, this option can
cause problems when used inappropriately
-o OUTPUT, --output OUTPUT
Set destination .osm file name and location.
-f, --force Force overwrite of output file.
Expand All @@ -145,6 +148,12 @@ options:
to 255. Values smaller than 3 disable the limit.
--add-z-value-tag TAGNAME
The tagname in which the z-value will be saved.
--add-version Add version to nodes, ways and relations. Use with
care, this option can cause problems when used
inappropriately
--add-timestamp Add timestamp to nodes, ways and relations. Use with
care, this option can cause problems when used
inappropriately
```

### As a library
Expand Down Expand Up @@ -203,6 +212,7 @@ osmdata = ogr2osm.OsmData(translation_object)
# - max_points_in_way: --split-ways parameter
# - add_bounds: --add-bounds parameter
# - start_id: --id parameter
# - is_positive: --positive-id parameter
# - z_value_tagname: --add-z-value-tag
osmdata.process(datasource)

Expand All @@ -215,6 +225,8 @@ datawriter = ogr2osm.OsmDataWriter(output_file)
# - no_upload_false: --no-upload-false parameter
# - never_download: --never-download parameter
# - locked: --locked parameter
# - add_version: --add-version parameter
# - add_timestamp: --add-timestamp parameter
# - significant_digits: --significant-digits parameter
# - suppress_empty_tags: --suppress-empty-tags parameter
# - max_tag_length: --max-tag-length parameter
Expand Down
9 changes: 6 additions & 3 deletions ogr2osm/ogr2osm.py
Expand Up @@ -105,7 +105,8 @@ def parse_commandline(logger):
parser.add_argument("--saveid", dest="saveid", type=str, default=None,
help="Save last ID after execution to a file.")
parser.add_argument("--positive-id", dest="positiveId", action="store_true",
help=argparse.SUPPRESS) # can cause problems when used inappropriately
help="Cause ID to increment. Use with care, this option can " +
"cause problems when used inappropriately")
# output file options
parser.add_argument("-o", "--output", dest="outputFile", metavar="OUTPUT",
help="Set destination .osm file name and location.")
Expand Down Expand Up @@ -138,9 +139,11 @@ def parse_commandline(logger):
parser.add_argument("--add-z-value-tag", dest="zValueTagName", type=str, metavar="TAGNAME",
help="The tagname in which the z-value will be saved.")
parser.add_argument("--add-version", dest="addVersion", action="store_true",
help=argparse.SUPPRESS) # can cause problems when used inappropriately
help="Add version to nodes, ways and relations. Use with care, " +
"this option can cause problems when used inappropriately")
parser.add_argument("--add-timestamp", dest="addTimestamp", action="store_true",
help=argparse.SUPPRESS) # can cause problems when used inappropriately
help="Add timestamp to nodes, ways and relations. Use with care, " +
"this option can cause problems when used inappropriately")
# required source file
parser.add_argument("source", metavar="DATASOURCE",
help="DATASOURCE can be a file path or a org PostgreSQL connection " +
Expand Down
44 changes: 28 additions & 16 deletions test/basic_usage.t
Expand Up @@ -10,10 +10,11 @@ usage:
[--rounding-digits ROUNDINGDIGITS]
[--significant-digits SIGNIFICANTDIGITS]
[--split-ways MAXNODESPERWAY] [--id ID] [--idfile IDFILE]
[--saveid SAVEID] [-o OUTPUT] [-f] [--pbf] [--no-upload-false]
[--never-download] [--never-upload] [--locked] [--add-bounds]
[--suppress-empty-tags] [--max-tag-length MAXTAGLENGTH]
[--add-z-value-tag TAGNAME]
[--saveid SAVEID] [--positive-id] [-o OUTPUT] [-f] [--pbf]
[--no-upload-false] [--never-download] [--never-upload]
[--locked] [--add-bounds] [--suppress-empty-tags]
[--max-tag-length MAXTAGLENGTH] [--add-z-value-tag TAGNAME]
[--add-version] [--add-timestamp]
DATASOURCE

positional arguments:
Expand Down Expand Up @@ -54,6 +55,8 @@ usage:
Defaults to 0.
--idfile IDFILE Read ID to start counting from from a file.
--saveid SAVEID Save last ID after execution to a file.
--positive-id Cause ID to increment. Use with care, this option can
cause problems when used inappropriately
-o OUTPUT, --output OUTPUT
Set destination .osm file name and location.
-f, --force Force overwrite of output file.
Expand All @@ -76,6 +79,12 @@ usage:
to 255. Values smaller than 3 disable the limit.
--add-z-value-tag TAGNAME
The tagname in which the z-value will be saved.
--add-version Add version to nodes, ways and relations. Use with
care, this option can cause problems when used
inappropriately
--add-timestamp Add timestamp to nodes, ways and relations. Use with
care, this option can cause problems when used
inappropriately
require_output_file_when_using_db_source:
$ ogr2osm "PG:dbname=test"
Expand All @@ -85,10 +94,11 @@ require_output_file_when_using_db_source:
[--rounding-digits ROUNDINGDIGITS]
[--significant-digits SIGNIFICANTDIGITS]
[--split-ways MAXNODESPERWAY] [--id ID] [--idfile IDFILE]
[--saveid SAVEID] [-o OUTPUT] [-f] [--pbf] [--no-upload-false]
[--never-download] [--never-upload] [--locked] [--add-bounds]
[--suppress-empty-tags] [--max-tag-length MAXTAGLENGTH]
[--add-z-value-tag TAGNAME]
[--saveid SAVEID] [--positive-id] [-o OUTPUT] [-f] [--pbf]
[--no-upload-false] [--never-download] [--never-upload]
[--locked] [--add-bounds] [--suppress-empty-tags]
[--max-tag-length MAXTAGLENGTH] [--add-z-value-tag TAGNAME]
[--add-version] [--add-timestamp]
DATASOURCE
ogr2osm: error: ERROR: An output file must be explicitly specified when using a database source
[2]
Expand All @@ -101,10 +111,11 @@ require_query_when_using_db_source:
[--rounding-digits ROUNDINGDIGITS]
[--significant-digits SIGNIFICANTDIGITS]
[--split-ways MAXNODESPERWAY] [--id ID] [--idfile IDFILE]
[--saveid SAVEID] [-o OUTPUT] [-f] [--pbf] [--no-upload-false]
[--never-download] [--never-upload] [--locked] [--add-bounds]
[--suppress-empty-tags] [--max-tag-length MAXTAGLENGTH]
[--add-z-value-tag TAGNAME]
[--saveid SAVEID] [--positive-id] [-o OUTPUT] [-f] [--pbf]
[--no-upload-false] [--never-download] [--never-upload]
[--locked] [--add-bounds] [--suppress-empty-tags]
[--max-tag-length MAXTAGLENGTH] [--add-z-value-tag TAGNAME]
[--add-version] [--add-timestamp]
DATASOURCE
ogr2osm: error: ERROR: You must specify a query with --sql when using a database source
[2]
Expand Down Expand Up @@ -144,10 +155,11 @@ duplicatefile:
[--rounding-digits ROUNDINGDIGITS]
[--significant-digits SIGNIFICANTDIGITS]
[--split-ways MAXNODESPERWAY] [--id ID] [--idfile IDFILE]
[--saveid SAVEID] [-o OUTPUT] [-f] [--pbf] [--no-upload-false]
[--never-download] [--never-upload] [--locked] [--add-bounds]
[--suppress-empty-tags] [--max-tag-length MAXTAGLENGTH]
[--add-z-value-tag TAGNAME]
[--saveid SAVEID] [--positive-id] [-o OUTPUT] [-f] [--pbf]
[--no-upload-false] [--never-download] [--never-upload]
[--locked] [--add-bounds] [--suppress-empty-tags]
[--max-tag-length MAXTAGLENGTH] [--add-z-value-tag TAGNAME]
[--add-version] [--add-timestamp]
DATASOURCE
ogr2osm: error: ERROR: output file '.*basic_geometries.osm' exists (re)
[2]
Expand Down

0 comments on commit 2a0c8b2

Please sign in to comment.