Skip to content

Commit

Permalink
#19 Add max members per relation parameter (non-functional)
Browse files Browse the repository at this point in the history
  • Loading branch information
roelderickx committed Oct 20, 2022
1 parent 7ac9948 commit 971a8d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ogr2osm/ogr2osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def parse_commandline(logger):
parser.add_argument("--split-ways", dest="maxNodesPerWay", type=int, default=1800,
help="Split ways with more than the specified number of nodes. " +
"Defaults to %(default)s. Any value below 2 - do not split.")
parser.add_argument("--split-relations", dest="maxMembersPerRelation", type=int, default=30000,
help="Split relations with more than the specified number of members. " +
"Defaults to %(default)s. Any value below 2 - do not split.")
# ID generation options
parser.add_argument("--id", dest="id", type=int, default=0,
help="ID to start counting from for the output file. " +
Expand Down Expand Up @@ -260,8 +263,8 @@ def main():

logger.info("Preparing to convert '%s' to '%s'.", params.source, params.outputFile)

osmdata = OsmData(translation_object, \
params.roundingDigits, params.maxNodesPerWay, params.addBounds)
osmdata = OsmData(translation_object, params.roundingDigits, \
params.maxNodesPerWay, params.maxMembersPerRelation, params.addBounds)
# create datasource and process data
datasource = OgrDatasource(translation_object, \
params.sourcePROJ4, params.sourceEPSG, params.gisorder, \
Expand Down
4 changes: 3 additions & 1 deletion ogr2osm/osm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
from .osm_geometries import OsmBoundary, OsmNode, OsmWay, OsmRelation

class OsmData:
def __init__(self, translation, rounding_digits=7, max_points_in_way=1800, add_bounds=False):
def __init__(self, translation, rounding_digits=7, \
max_points_in_way=1800, max_members_in_relation = 30000, add_bounds=False):
self.logger = logging.getLogger(__program__)

# options
self.translation = translation
self.rounding_digits = rounding_digits
self.max_points_in_way = max_points_in_way
self.max_members_in_relation = max_members_in_relation
self.add_bounds = add_bounds

self.__bounds = OsmBoundary()
Expand Down

0 comments on commit 971a8d1

Please sign in to comment.