Skip to content

Commit 705d82d

Browse files
authored
Hotfixes from recent release (#14)
* typo * fix oversight in linestring meta modification (caused in merge conflict) * skip-nodes as default
1 parent 80e3d05 commit 705d82d

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

changegen/generator.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -573,17 +573,32 @@ def generate_changes(
573573
):
574574
raise NotImplementedError("Multi geometries not supported.")
575575
if isinstance(wgs84_geom, sg.LineString):
576-
ways, nodes = _generate_ways_and_nodes(
577-
wgs84_geom,
578-
ids,
579-
feat_tags,
580-
intersection_db,
581-
max_nodes_per_way=max_nodes_per_way,
582-
)
583-
new_nodes.extend(nodes)
584-
new_ways.extend(ways)
585-
_global_node_id_all_ways.extend(chain.from_iterable([w.nds for w in ways]))
586-
if isinstance(wgs84_geom, sg.Polygon):
576+
## NOTE that modify_only does not support modifying geometries.
577+
if modify_only:
578+
existing_id = feature.GetFieldAsString(feature.GetFieldIndex("osm_id"))
579+
580+
new_ways.append(
581+
Way(
582+
id=existing_id,
583+
version=2,
584+
nds=existing_nodes_for_ways[existing_id],
585+
tags=[tag for tag in feat_tags if tag.key != "osm_id"],
586+
)
587+
)
588+
else: # not modifying, just creating
589+
ways, nodes = _generate_ways_and_nodes(
590+
wgs84_geom,
591+
ids,
592+
feat_tags,
593+
intersection_db,
594+
max_nodes_per_way=max_nodes_per_way,
595+
)
596+
new_nodes.extend(nodes)
597+
new_ways.extend(ways)
598+
_global_node_id_all_ways.extend(
599+
chain.from_iterable([w.nds for w in ways])
600+
)
601+
elif isinstance(wgs84_geom, sg.Polygon):
587602
## If we're taking all features to be newly-created (~modify_only)
588603
## we need to create ways and nodes for that feature.
589604
## IF we're only modifying existing features with features
@@ -796,7 +811,7 @@ def generate_deletions(
796811
osmsrc,
797812
outfile,
798813
compress=True,
799-
skip_nodes=False,
814+
skip_nodes=True,
800815
):
801816
"""
802817
Produce a changefile with <delete> nodes for all IDs in table.

0 commit comments

Comments
 (0)