From ecc86b6d6af0870242fc2fd73f11e42dc62a0d79 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sun, 27 Oct 2019 17:15:27 -0700 Subject: [PATCH] revamping MapFixes. very straightforward full override of synthetic/normal stuff, including geometry. no more semantically weird hints like merging roads. some bugs left. --- data/fixes/520.json | 1427 --------------------------- data/fixes/misc_23rd.json | 469 --------- data/fixes/misc_caphill.json | 51 - data/fixes/misc_montlake.json | 24 - data/fixes/montlake_roundabout.json | 487 --------- map_editor/src/main.rs | 2 +- map_editor/src/model.rs | 168 +--- map_model/src/raw.rs | 332 +++---- 8 files changed, 191 insertions(+), 2769 deletions(-) delete mode 100644 data/fixes/520.json delete mode 100644 data/fixes/misc_23rd.json delete mode 100644 data/fixes/misc_caphill.json delete mode 100644 data/fixes/misc_montlake.json delete mode 100644 data/fixes/montlake_roundabout.json diff --git a/data/fixes/520.json b/data/fixes/520.json deleted file mode 100644 index fbae7ee7e5..0000000000 --- a/data/fixes/520.json +++ /dev/null @@ -1,1427 +0,0 @@ -{ - "gps_bounds": { - "min_lon": -122.3218, - "min_lat": 47.6315, - "max_lon": -122.2985, - "max_lat": 47.6475 - }, - "override_metadata": [ - [ - { - "osm_way_id": 157189000, - "node1": 53128052, - "node2": 3391701875 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "157189000", - "abst:parking_lane_fwd": "true", - "highway": "tertiary", - "lanes": "3", - "lanes:backward": "1", - "lanes:forward": "2", - "maxspeed": "30 mph", - "name": "East Roanoke Street", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 332060228, - "node1": 3391701887, - "node2": 5417462688 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "332060228", - "abst:parking_lane_back": "true", - "abst:parking_lane_fwd": "true", - "highway": "secondary", - "lanes": "2", - "maxspeed": "30 mph", - "name": "East Lake Washington Boulevard" - }, - [] - ] - ], - [ - { - "osm_way_id": 332060248, - "node1": 53128053, - "node2": 3391701883 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "332060248", - "highway": "secondary", - "lanes": "3", - "maxspeed": "30 mph", - "name": "East Montlake Place East", - "old_ref": "WA 513 (Old SSH 1J)", - "oneway": "yes", - "trolley_wire": "yes", - "turn:lanes": "left|through|through" - }, - [] - ] - ], - [ - { - "osm_way_id": 332060259, - "node1": 3391701877, - "node2": 53128052 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "332060259", - "highway": "secondary_link", - "lanes": "1", - "maxspeed": "30 mph", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 332060261, - "node1": 3391701872, - "node2": 3391701869 - }, - [ - { - "abst:endpt_fwd": "true", - "abst:osm_way_id": "332060261", - "highway": "secondary", - "lanes": "2", - "maxspeed": "30 mph", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 332060263, - "node1": 3391701877, - "node2": 3391701875 - }, - [ - { - "abst:endpt_fwd": "true", - "abst:osm_way_id": "332060263", - "abst:parking_lane_fwd": "true", - "highway": "secondary", - "lanes": "2", - "maxspeed": "30 mph", - "name": "East Montlake Place East", - "old_ref": "SSH 1J", - "oneway": "yes", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 361443212, - "node1": 5413301445, - "node2": 2247309277 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "361443212", - "abst:parking_lane_fwd": "true", - "highway": "primary", - "lanes": "2", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "ref": "WA 513", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 426250826, - "node1": 4240312878, - "node2": 3391701887 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "426250826", - "highway": "secondary", - "lanes": "2", - "name": "East Lake Washington Boulevard", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 459083143, - "node1": 4549993731, - "node2": 4550007326 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "459083143", - "access:lanes": "||no", - "bus:lanes": "||designated", - "highway": "primary", - "lanes": "3", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "ref": "WA 513", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 459084308, - "node1": 59677236, - "node2": 4550007325 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "459084308", - "highway": "primary", - "lanes": "2", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "ref": "WA 513", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 490622980, - "node1": 4828090661, - "node2": 29464223 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "490622980", - "highway": "primary", - "lanes": "3", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "ref": "WA 513", - "trolley_wire": "yes", - "turn:lanes": "left||" - }, - [] - ] - ], - [ - { - "osm_way_id": 532912457, - "node1": 4550007326, - "node2": 59677236 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "532912457", - "abst:parking_lane_fwd": "true", - "access:lanes": "||no", - "bus:lanes": "||designated", - "highway": "primary", - "lanes": "3", - "name": "Montlake Boulevard East", - "old_ref": "SSH 1J", - "oneway": "yes", - "ref": "WA 513", - "trolley_wire": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 607798222, - "node1": 720880672, - "node2": 3391701882 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "607798222", - "bicycle": "no", - "highway": "motorway_link", - "lanes": "2", - "oneway": "yes", - "toll": "no" - }, - [] - ] - ] - ], - "delete_roads": [ - { - "osm_way_id": 428224942, - "node1": 29463657, - "node2": 4303514198 - }, - { - "osm_way_id": 428224942, - "node1": 4303514198, - "node2": 4240331992 - }, - { - "osm_way_id": 426250826, - "node1": 4240312878, - "node2": 3391701887 - }, - { - "osm_way_id": 426250827, - "node1": 29449863, - "node2": 29464223 - }, - { - "osm_way_id": 424636849, - "node1": 4240312868, - "node2": 4240312871 - }, - { - "osm_way_id": 424636850, - "node1": 3391701887, - "node2": 29449863 - }, - { - "osm_way_id": 332060228, - "node1": 3391701887, - "node2": 5417462688 - }, - { - "osm_way_id": 424636852, - "node1": 53128053, - "node2": 4240312878 - }, - { - "osm_way_id": 4634847, - "node1": 29449867, - "node2": 720880672 - }, - { - "osm_way_id": 431103956, - "node1": 4240331992, - "node2": 4240312872 - }, - { - "osm_way_id": 431103958, - "node1": 4303514203, - "node2": 29464222 - }, - { - "osm_way_id": 424636846, - "node1": 4136765600, - "node2": 488959741 - }, - { - "osm_way_id": 332060248, - "node1": 53128053, - "node2": 3391701883 - }, - { - "osm_way_id": 361443212, - "node1": 5413301445, - "node2": 2247309277 - }, - { - "osm_way_id": 424807773, - "node1": 29464212, - "node2": 4240312868 - }, - { - "osm_way_id": 428224936, - "node1": 53198127, - "node2": 1635790583 - }, - { - "osm_way_id": 4636105, - "node1": 29463657, - "node2": 488959736 - }, - { - "osm_way_id": 424807771, - "node1": 4240312862, - "node2": 4136765600 - }, - { - "osm_way_id": 40416106, - "node1": 29449871, - "node2": 29449867 - }, - { - "osm_way_id": 428343454, - "node1": 720880672, - "node2": 3391701880 - }, - { - "osm_way_id": 481291029, - "node1": 53128052, - "node2": 3391701878 - }, - { - "osm_way_id": 424807772, - "node1": 29447666, - "node2": 4240312865 - }, - { - "osm_way_id": 40416108, - "node1": 29447668, - "node2": 29447666 - }, - { - "osm_way_id": 561381711, - "node1": 5413301452, - "node2": 5413301445 - }, - { - "osm_way_id": 332060263, - "node1": 3391701882, - "node2": 3391701880 - }, - { - "osm_way_id": 332060263, - "node1": 3391701880, - "node2": 3391701878 - }, - { - "osm_way_id": 332060263, - "node1": 3391701878, - "node2": 3391701877 - }, - { - "osm_way_id": 332060263, - "node1": 3391701877, - "node2": 3391701875 - }, - { - "osm_way_id": 4636259, - "node1": 29449863, - "node2": 4828090657 - }, - { - "osm_way_id": 332060258, - "node1": 3391701875, - "node2": 1635790583 - }, - { - "osm_way_id": 332060259, - "node1": 3391701877, - "node2": 53128052 - }, - { - "osm_way_id": 431103957, - "node1": 4303514204, - "node2": 4303514203 - }, - { - "osm_way_id": 332060261, - "node1": 3391701875, - "node2": 3391701872 - }, - { - "osm_way_id": 332060243, - "node1": 1635790583, - "node2": 53128053 - }, - { - "osm_way_id": 428224940, - "node1": 4240312872, - "node2": 4828090661 - }, - { - "osm_way_id": 424636848, - "node1": 4240312865, - "node2": 4240312871 - }, - { - "osm_way_id": 561381710, - "node1": 5413301451, - "node2": 4240312862 - }, - { - "osm_way_id": 490622980, - "node1": 4828090661, - "node2": 29464223 - }, - { - "osm_way_id": 607798222, - "node1": 720880672, - "node2": 3391701882 - }, - { - "osm_way_id": 424636851, - "node1": 3391701883, - "node2": 4240312878 - }, - { - "osm_way_id": 490622982, - "node1": 4828090657, - "node2": 4240314159 - }, - { - "osm_way_id": 431103954, - "node1": 4303514198, - "node2": 4303514204 - }, - { - "osm_way_id": 332060260, - "node1": 29464223, - "node2": 3391701882 - }, - { - "osm_way_id": 531617255, - "node1": 29464223, - "node2": 29464222 - }, - { - "osm_way_id": 4636141, - "node1": 29464222, - "node2": 29464212 - }, - { - "osm_way_id": 6390208, - "node1": 53128053, - "node2": 53137203 - }, - { - "osm_way_id": 130470645, - "node1": 59677231, - "node2": 29463657 - }, - { - "osm_way_id": 426250828, - "node1": 3391701882, - "node2": 3391701883 - }, - { - "osm_way_id": 157189000, - "node1": 53128052, - "node2": 3391701875 - }, - { - "osm_way_id": 431103955, - "node1": 4240314159, - "node2": 5413301445 - }, - { - "osm_way_id": 332060236, - "node1": 3391701883, - "node2": 29449863 - }, - { - "osm_way_id": 428224939, - "node1": 4273590092, - "node2": 59677231 - }, - { - "osm_way_id": 459083143, - "node1": 4549993731, - "node2": 4550007326 - }, - { - "osm_way_id": 537697092, - "node1": 2247309277, - "node2": 4549993731 - }, - { - "osm_way_id": 130470644, - "node1": 1437096596, - "node2": 59677236 - }, - { - "osm_way_id": 459084308, - "node1": 59677236, - "node2": 4550007325 - }, - { - "osm_way_id": 532912457, - "node1": 4550007326, - "node2": 59677236 - }, - { - "osm_way_id": 428224941, - "node1": 4550007325, - "node2": 4273590092 - }, - { - "osm_way_id": 459084309, - "node1": 4550007325, - "node2": 4550007326 - }, - { - "osm_way_id": 459084307, - "node1": 59710790, - "node2": 4550007325 - }, - { - "osm_way_id": 455809716, - "node1": 491979474, - "node2": 4550007326 - }, - { - "osm_way_id": 459084306, - "node1": 59710787, - "node2": 491979474 - }, - { - "osm_way_id": 455437650, - "node1": 2247309277, - "node2": 491979463 - }, - { - "osm_way_id": 40416113, - "node1": 59677231, - "node2": 2247309277 - }, - { - "osm_way_id": 157188999, - "node1": 53128052, - "node2": 3391701872 - }, - { - "osm_way_id": 332060261, - "node1": 3391701872, - "node2": 3391701869 - }, - { - "osm_way_id": 332060253, - "node1": 3391701869, - "node2": 53198127 - }, - { - "osm_way_id": 6444010, - "node1": 53198127, - "node2": 53198128 - } - ], - "delete_intersections": [ - { - "osm_node_id": 29463657 - }, - { - "osm_node_id": 4240331992 - }, - { - "osm_node_id": 4240312878 - }, - { - "osm_node_id": 3391701887 - }, - { - "osm_node_id": 29449863 - }, - { - "osm_node_id": 29464223 - }, - { - "osm_node_id": 4240312868 - }, - { - "osm_node_id": 53128053 - }, - { - "osm_node_id": 29449867 - }, - { - "osm_node_id": 720880672 - }, - { - "osm_node_id": 4240312872 - }, - { - "osm_node_id": 4303514203 - }, - { - "osm_node_id": 29464222 - }, - { - "osm_node_id": 4136765600 - }, - { - "osm_node_id": 3391701883 - }, - { - "osm_node_id": 5413301445 - }, - { - "osm_node_id": 29464212 - }, - { - "osm_node_id": 1635790583 - }, - { - "osm_node_id": 4240312862 - }, - { - "osm_node_id": 3391701880 - }, - { - "osm_node_id": 3391701878 - }, - { - "osm_node_id": 29447666 - }, - { - "osm_node_id": 4240312865 - }, - { - "osm_node_id": 3391701882 - }, - { - "osm_node_id": 3391701875 - }, - { - "osm_node_id": 4828090657 - }, - { - "osm_node_id": 3391701877 - }, - { - "osm_node_id": 4303514204 - }, - { - "osm_node_id": 4828090661 - }, - { - "osm_node_id": 4240314159 - }, - { - "osm_node_id": 4303514198 - }, - { - "osm_node_id": 4549993731 - }, - { - "osm_node_id": 59677236 - }, - { - "osm_node_id": 4273590092 - }, - { - "osm_node_id": 4550007325 - }, - { - "osm_node_id": 4550007326 - }, - { - "osm_node_id": 491979474 - }, - { - "osm_node_id": 2247309277 - }, - { - "osm_node_id": 3391701872 - }, - { - "osm_node_id": 53198127 - } - ], - "add_intersections": [ - { - "point": { - "inner_x": 1284.7098, - "inner_y": 120.6835 - }, - "intersection_type": "TrafficSignal", - "label": null, - "orig_id": { - "osm_node_id": -1569786688 - }, - "synthetic": true - }, - { - "point": { - "inner_x": 1293.1381, - "inner_y": 189.8009 - }, - "intersection_type": "StopSign", - "label": null, - "orig_id": { - "osm_node_id": -1569786699 - }, - "synthetic": true - }, - { - "point": { - "inner_x": 1293.5267, - "inner_y": 292.4207 - }, - "intersection_type": "TrafficSignal", - "label": null, - "orig_id": { - "osm_node_id": -1569786719 - }, - "synthetic": true - }, - { - "point": { - "inner_x": 1331.3542, - "inner_y": 393.7066 - }, - "intersection_type": "TrafficSignal", - "label": null, - "orig_id": { - "osm_node_id": -1569786822 - }, - "synthetic": true - }, - { - "point": { - "inner_x": 1362.5729, - "inner_y": 444.7162 - }, - "intersection_type": "TrafficSignal", - "label": null, - "orig_id": { - "osm_node_id": -1569786907 - }, - "synthetic": true - }, - { - "point": { - "inner_x": 1195.7391, - "inner_y": 418.7821 - }, - "intersection_type": "StopSign", - "label": null, - "orig_id": { - "osm_node_id": -1571780064 - }, - "synthetic": true - } - ], - "add_roads": [ - { - "i1": 383, - "i2": 158, - "center_points": [ - { - "inner_x": 1284.7098, - "inner_y": 120.6835 - }, - { - "inner_x": 1286.9589, - "inner_y": 66.2166 - } - ], - "orig_id": { - "osm_way_id": -1569786691, - "node1": -1569786688, - "node2": 1437096596 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786691", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 383, - "i2": 239, - "center_points": [ - { - "inner_x": 1284.7098, - "inner_y": 120.6835 - }, - { - "inner_x": 1236.2587, - "inner_y": 121.2136 - } - ], - "orig_id": { - "osm_way_id": -1569786693, - "node1": -1569786688, - "node2": 59710790 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786693", - "abst:synthetic": "true", - "abst:synthetic_lanes": "s/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 383, - "i2": 257, - "center_points": [ - { - "inner_x": 1284.7098, - "inner_y": 120.6835 - }, - { - "inner_x": 1340.5141, - "inner_y": 122.3589 - } - ], - "orig_id": { - "osm_way_id": -1569786695, - "node1": -1569786688, - "node2": 59710787 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786695", - "abst:synthetic": "true", - "abst:synthetic_lanes": "s/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 384, - "i2": 383, - "center_points": [ - { - "inner_x": 1293.1381, - "inner_y": 189.8009 - }, - { - "inner_x": 1284.7098, - "inner_y": 120.6835 - } - ], - "orig_id": { - "osm_way_id": -1569786702, - "node1": -1569786699, - "node2": -1569786688 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786702", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 384, - "i2": 227, - "center_points": [ - { - "inner_x": 1293.1381, - "inner_y": 189.8009 - }, - { - "inner_x": 1277.1575, - "inner_y": 216.0962 - } - ], - "orig_id": { - "osm_way_id": -1569786708, - "node1": -1569786699, - "node2": 59677231 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786708", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/s", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 384, - "i2": 3, - "center_points": [ - { - "inner_x": 1293.1381, - "inner_y": 189.8009 - }, - { - "inner_x": 1307.8055, - "inner_y": 216.1629 - } - ], - "orig_id": { - "osm_way_id": -1569786711, - "node1": -1569786699, - "node2": 491979463 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786711", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/s", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 385, - "i2": 384, - "center_points": [ - { - "inner_x": 1293.5267, - "inner_y": 292.4207 - }, - { - "inner_x": 1293.1381, - "inner_y": 189.8009 - } - ], - "orig_id": { - "osm_way_id": -1569786722, - "node1": -1569786719, - "node2": -1569786699 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786722", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 238, - "i2": 385, - "center_points": [ - { - "inner_x": 1681.2533, - "inner_y": 254.7476 - }, - { - "inner_x": 1293.5267, - "inner_y": 292.4207 - } - ], - "orig_id": { - "osm_way_id": -1569786736, - "node1": 5413301452, - "node2": -1569786719 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786736", - "abst:synthetic": "true", - "abst:synthetic_lanes": "d/", - "highway": "motorway_link", - "maxspeed": "60 mph", - "name": "" - }, - "turn_restrictions": [] - }, - { - "i1": 385, - "i2": 189, - "center_points": [ - { - "inner_x": 1293.5267, - "inner_y": 292.4207 - }, - { - "inner_x": 1156.7763, - "inner_y": 385.435 - } - ], - "orig_id": { - "osm_way_id": -1569786754, - "node1": -1569786719, - "node2": 488959736 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786754", - "abst:synthetic": "true", - "abst:synthetic_lanes": "d/", - "highway": "motorway_link", - "maxspeed": "60 mph", - "name": "" - }, - "turn_restrictions": [] - }, - { - "i1": 152, - "i2": 305, - "center_points": [ - { - "inner_x": 1154.9404, - "inner_y": 396.2431 - }, - { - "inner_x": 1681.613, - "inner_y": 271.1043 - } - ], - "orig_id": { - "osm_way_id": -1569786768, - "node1": 488959741, - "node2": 5413301451 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786768", - "abst:synthetic": "true", - "abst:synthetic_lanes": "/dd", - "highway": "motorway", - "maxspeed": "60 mph", - "name": "Portage Bay Viaduct" - }, - "turn_restrictions": [] - }, - { - "i1": 235, - "i2": 45, - "center_points": [ - { - "inner_x": 1166.8399, - "inner_y": 401.814 - }, - { - "inner_x": 1463.1209, - "inner_y": 349.6636 - } - ], - "orig_id": { - "osm_way_id": -1569786800, - "node1": 29447668, - "node2": 4240312871 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786800", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dd/", - "highway": "motorway", - "maxspeed": "60 mph", - "name": "Portage Bay Viaduct" - }, - "turn_restrictions": [] - }, - { - "i1": 386, - "i2": 385, - "center_points": [ - { - "inner_x": 1331.3542, - "inner_y": 393.7066 - }, - { - "inner_x": 1293.5267, - "inner_y": 292.4207 - } - ], - "orig_id": { - "osm_way_id": -1569786827, - "node1": -1569786822, - "node2": -1569786719 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786827", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 73, - "i2": 386, - "center_points": [ - { - "inner_x": 1479.9061, - "inner_y": 371.2687 - }, - { - "inner_x": 1331.3542, - "inner_y": 393.7066 - } - ], - "orig_id": { - "osm_way_id": -1569786886, - "node1": 5417462688, - "node2": -1569786822 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786886", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 199, - "i2": 386, - "center_points": [ - { - "inner_x": 1186.2178, - "inner_y": 460.1913 - }, - { - "inner_x": 1331.3542, - "inner_y": 393.7066 - } - ], - "orig_id": { - "osm_way_id": -1569786900, - "node1": 29449871, - "node2": -1569786822 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786900", - "abst:synthetic": "true", - "abst:synthetic_lanes": "d/", - "highway": "motorway_link", - "maxspeed": "", - "name": "" - }, - "turn_restrictions": [] - }, - { - "i1": 387, - "i2": 386, - "center_points": [ - { - "inner_x": 1362.5729, - "inner_y": 444.7162 - }, - { - "inner_x": 1331.3542, - "inner_y": 393.7066 - } - ], - "orig_id": { - "osm_way_id": -1569786914, - "node1": -1569786907, - "node2": -1569786822 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786914", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 387, - "i2": 230, - "center_points": [ - { - "inner_x": 1362.5729, - "inner_y": 444.7162 - }, - { - "inner_x": 1473.132, - "inner_y": 446.2364 - } - ], - "orig_id": { - "osm_way_id": -1569786927, - "node1": -1569786907, - "node2": 53070282 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786927", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 387, - "i2": 100, - "center_points": [ - { - "inner_x": 1362.5729, - "inner_y": 444.7162 - }, - { - "inner_x": 1418.3329, - "inner_y": 497.4861 - } - ], - "orig_id": { - "osm_way_id": -1569786951, - "node1": -1569786907, - "node2": 3391701869 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786951", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "highway": "secondary", - "maxspeed": "30 mph", - "name": "East Montlake Place East" - }, - "turn_restrictions": [] - }, - { - "i1": 40, - "i2": 387, - "center_points": [ - { - "inner_x": 1350.4503, - "inner_y": 480.3287 - }, - { - "inner_x": 1362.5729, - "inner_y": 444.7162 - } - ], - "orig_id": { - "osm_way_id": -1569786954, - "node1": 53128052, - "node2": -1569786907 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569786954", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 386, - "i2": 389, - "center_points": [ - { - "inner_x": 1331.3542, - "inner_y": 393.7066 - }, - { - "inner_x": 1195.7391, - "inner_y": 418.7821 - } - ], - "orig_id": { - "osm_way_id": -1571780069, - "node1": -1569786822, - "node2": -1571780064 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1571780069", - "abst:synthetic": "true", - "abst:synthetic_lanes": "d/", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 389, - "i2": 235, - "center_points": [ - { - "inner_x": 1195.7391, - "inner_y": 418.7821 - }, - { - "inner_x": 1166.8399, - "inner_y": 401.814 - } - ], - "orig_id": { - "osm_way_id": -1571780074, - "node1": -1571780064, - "node2": 29447668 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1571780074", - "abst:synthetic": "true", - "abst:synthetic_lanes": "d/", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - } - ], - "merge_short_roads": [] -} \ No newline at end of file diff --git a/data/fixes/misc_23rd.json b/data/fixes/misc_23rd.json deleted file mode 100644 index 40653b1ee9..0000000000 --- a/data/fixes/misc_23rd.json +++ /dev/null @@ -1,469 +0,0 @@ -{ - "gps_bounds": { - "min_lon": -122.31036966897096, - "min_lat": 47.597290174872846, - "max_lon": -122.291527254181, - "max_lat": 47.65513966206871 - }, - "override_metadata": [ - [ - { - "osm_way_id": 6343960, - "node1": 246758543, - "node2": 53068959 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "6343960", - "highway": "residential", - "lanes": "2", - "maxspeed": "25 mph", - "name": "East Olive Street", - "oneway": "yes", - "surface": "asphalt" - }, - [] - ] - ], - [ - { - "osm_way_id": 92170540, - "node1": 53211694, - "node2": 53211693 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "92170540", - "highway": "secondary", - "lanes": "4", - "maxspeed": "30 mph", - "name": "23rd Avenue East", - "surface": "concrete" - }, - [] - ] - ], - [ - { - "osm_way_id": 243334881, - "node1": 53211693, - "node2": 53100545 - }, - [ - { - "abst:endpt_back": "true", - "abst:osm_way_id": "243334881", - "abst:parking_lane_back": "true", - "abst:parking_lane_fwd": "true", - "highway": "residential", - "lanes": "2", - "maxspeed": "25 mph", - "name": "East Denny Way" - }, - [] - ] - ], - [ - { - "osm_way_id": 337739267, - "node1": 3448781094, - "node2": 3447973924 - }, - [ - { - "abst:endpt_fwd": "true", - "abst:osm_way_id": "337739267", - "highway": "residential", - "lanes": "2", - "maxspeed": "25 mph", - "name": "20th Avenue", - "oneway": "yes", - "surface": "asphalt" - }, - [] - ] - ], - [ - { - "osm_way_id": 337739271, - "node1": 3447973929, - "node2": 246758543 - }, - [ - { - "abst:endpt_fwd": "true", - "abst:osm_way_id": "337739271", - "highway": "residential", - "lanes": "2", - "maxspeed": "25 mph", - "name": "East Olive Street", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 338701493, - "node1": 3458337321, - "node2": 53211693 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "338701493", - "highway": "residential", - "lanes": "2", - "maxspeed": "25 mph", - "name": "East Denny Way", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 385214478, - "node1": 31429758, - "node2": 29464758 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "385214478", - "highway": "primary", - "lanes": "5", - "lanes:backward": "3", - "lanes:forward": "2", - "maxspeed": "30 mph", - "name": "Montlake Boulevard Northeast", - "old_ref": "SSH 1J", - "ref": "WA 513", - "shoulder": "no", - "sidewalk": "both", - "surface": "asphalt", - "turn:lanes:backward": "left|through|through" - }, - [ - [ - "BanTurns", - { - "osm_way_id": 385214478, - "node1": 31429758, - "node2": 29464758 - } - ], - [ - "BanTurns", - { - "osm_way_id": 499392305, - "node1": 32103268, - "node2": 31429758 - } - ], - [ - "BanTurns", - { - "osm_way_id": 4910588, - "node1": 29464758, - "node2": 32103268 - } - ] - ] - ] - ], - [ - { - "osm_way_id": 537678339, - "node1": 3458337321, - "node2": 53211694 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "537678339", - "abst:parking_inferred": "true", - "highway": "secondary", - "lanes": "5", - "lanes:backward": "2", - "lanes:forward": "3", - "maxspeed": "30 mph", - "name": "East Madison Street", - "old_ref": "WA 513 (Old SSH 1J)", - "parking:lane:right": "no_parking", - "sidewalk": "both", - "turn:lanes:forward": "left||" - }, - [] - ] - ] - ], - "delete_roads": [ - { - "osm_way_id": 92170540, - "node1": 53211694, - "node2": 53211693 - }, - { - "osm_way_id": 428235514, - "node1": 4273706425, - "node2": 3458337321 - }, - { - "osm_way_id": 243334881, - "node1": 53211693, - "node2": 53100545 - }, - { - "osm_way_id": 396055523, - "node1": 53211693, - "node2": 53068963 - }, - { - "osm_way_id": 337739271, - "node1": 3447973929, - "node2": 246758543 - }, - { - "osm_way_id": 6343960, - "node1": 246758543, - "node2": 53068959 - }, - { - "osm_way_id": 337818462, - "node1": 3448781094, - "node2": 3447973929 - }, - { - "osm_way_id": 337739267, - "node1": 3448781094, - "node2": 3447973924 - }, - { - "osm_way_id": 337739271, - "node1": 3447973924, - "node2": 3447973929 - }, - { - "osm_way_id": 337739269, - "node1": 246758543, - "node2": 53068961 - }, - { - "osm_way_id": 481291488, - "node1": 53168891, - "node2": 3447973924 - }, - { - "osm_way_id": 337739267, - "node1": 53068959, - "node2": 3448781094 - }, - { - "osm_way_id": 338701493, - "node1": 3458337321, - "node2": 53211693 - } - ], - "delete_intersections": [ - { - "osm_node_id": 3447973929 - }, - { - "osm_node_id": 246758543 - }, - { - "osm_node_id": 3447973924 - }, - { - "osm_node_id": 3448781094 - } - ], - "add_intersections": [], - "add_roads": [ - { - "i1": 431, - "i2": 356, - "center_points": [ - { - "inner_x": 546.3455, - "inner_y": 4038.4176 - }, - { - "inner_x": 586.6938, - "inner_y": 3998.0761 - } - ], - "orig_id": { - "osm_way_id": -1569862944, - "node1": 4273706425, - "node2": 53211694 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569862944", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ddps/ddps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 356, - "i2": 473, - "center_points": [ - { - "inner_x": 586.6938, - "inner_y": 3998.0761 - }, - { - "inner_x": 688.0182, - "inner_y": 4026.5086 - } - ], - "orig_id": { - "osm_way_id": -1569862946, - "node1": 53211694, - "node2": 53100545 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569862946", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 356, - "i2": 751, - "center_points": [ - { - "inner_x": 586.6938, - "inner_y": 3998.0761 - }, - { - "inner_x": 584.4518, - "inner_y": 4228.3497 - } - ], - "orig_id": { - "osm_way_id": -1569862953, - "node1": 53211694, - "node2": 53068963 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569862953", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dds/dds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 70, - "i2": 31, - "center_points": [ - { - "inner_x": 315.8406, - "inner_y": 4211.3591 - }, - { - "inner_x": 312.084, - "inner_y": 4431.1359 - } - ], - "orig_id": { - "osm_way_id": -1569863408, - "node1": 53068959, - "node2": 53168891 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569863408", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 70, - "i2": 68, - "center_points": [ - { - "inner_x": 315.8406, - "inner_y": 4211.3591 - }, - { - "inner_x": 411.6012, - "inner_y": 4227.0376 - } - ], - "orig_id": { - "osm_way_id": -1569863411, - "node1": 53068959, - "node2": 53068961 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569863411", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - } - ], - "merge_short_roads": [ - { - "osm_way_id": 6460085, - "node1": 53211697, - "node2": 53211698 - }, - { - "osm_way_id": 486875123, - "node1": 246753651, - "node2": 53062805 - }, - { - "osm_way_id": 394736758, - "node1": 1726088135, - "node2": 53103988 - }, - { - "osm_way_id": 256996977, - "node1": 53139022, - "node2": 53224620 - }, - { - "osm_way_id": 6380913, - "node1": 53125309, - "node2": 53125310 - }, - { - "osm_way_id": 6507818, - "node1": 53144329, - "node2": 53144350 - } - ] -} \ No newline at end of file diff --git a/data/fixes/misc_caphill.json b/data/fixes/misc_caphill.json deleted file mode 100644 index 80f966b900..0000000000 --- a/data/fixes/misc_caphill.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "gps_bounds": { - "min_lon": -122.33521557443338, - "min_lat": 47.605453088643266, - "max_lon": -122.28604060126838, - "max_lat": 47.65727694392701 - }, - "override_metadata": [], - "delete_roads": [ - { - "osm_way_id": 160553203, - "node1": 60407342, - "node2": 1726088128 - } - ], - "delete_intersections": [], - "add_intersections": [], - "add_roads": [], - "merge_short_roads": [ - { - "osm_way_id": 6521205, - "node1": 1758004075, - "node2": 53118266 - }, - { - "osm_way_id": 8071894, - "node1": 53110518, - "node2": 60407342 - }, - { - "osm_way_id": 462701470, - "node1": 53110518, - "node2": 1726088128 - }, - { - "osm_way_id": 6470834, - "node1": 4272388261, - "node2": 53110518 - }, - { - "osm_way_id": 428098986, - "node1": 4274312036, - "node2": 4272388261 - }, - { - "osm_way_id": 6457203, - "node1": 53209418, - "node2": 60799506 - } - ] -} \ No newline at end of file diff --git a/data/fixes/misc_montlake.json b/data/fixes/misc_montlake.json deleted file mode 100644 index c9fe0d9c4a..0000000000 --- a/data/fixes/misc_montlake.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "gps_bounds": { - "min_lon": -122.3218, - "min_lat": 47.6315, - "max_lon": -122.2985, - "max_lat": 47.6475 - }, - "override_metadata": [], - "delete_roads": [ - { - "osm_way_id": 6413596, - "node1": 1726081485, - "node2": 53149395 - } - ], - "delete_intersections": [ - { - "osm_node_id": 1726081485 - } - ], - "add_intersections": [], - "add_roads": [], - "merge_short_roads": [] -} \ No newline at end of file diff --git a/data/fixes/montlake_roundabout.json b/data/fixes/montlake_roundabout.json deleted file mode 100644 index 7de8d69ce2..0000000000 --- a/data/fixes/montlake_roundabout.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "gps_bounds": { - "min_lon": -122.3218, - "min_lat": 47.6315, - "max_lon": -122.2985, - "max_lat": 47.6475 - }, - "override_metadata": [ - [ - { - "osm_way_id": 394991043, - "node1": 3978753110, - "node2": 3978753097 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "394991043", - "bicycle": "designated", - "cycleway": "shared_lane", - "highway": "tertiary", - "lanes": "1", - "maxspeed": "30 mph", - "name": "Boyer Avenue East", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 394991044, - "node1": 3978753107, - "node2": 3978753110 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "394991044", - "bicycle": "designated", - "cycleway": "shared_lane", - "highway": "tertiary", - "lanes": "1", - "maxspeed": "30 mph", - "name": "Boyer Avenue East", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 394991045, - "node1": 3978753087, - "node2": 2499822233 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "394991045", - "abst:parking_lane_fwd": "true", - "bicycle": "designated", - "cycleway": "shared_lane", - "highway": "tertiary", - "lanes": "1", - "maxspeed": "30 mph", - "name": "Boyer Avenue East", - "oneway": "yes" - }, - [] - ] - ], - [ - { - "osm_way_id": 394991048, - "node1": 3978753110, - "node2": 3978753099 - }, - [ - { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "394991048", - "destination": "East Lynn Street", - "highway": "tertiary_link", - "lanes": "1", - "oneway": "yes" - }, - [] - ] - ] - ], - "delete_roads": [ - { - "osm_way_id": 394991046, - "node1": 3978753099, - "node2": 3978753097 - }, - { - "osm_way_id": 394991045, - "node1": 3978753087, - "node2": 2499822233 - }, - { - "osm_way_id": 394991042, - "node1": 2499822233, - "node2": 3978753092 - }, - { - "osm_way_id": 394991047, - "node1": 3978753097, - "node2": 3978753087 - }, - { - "osm_way_id": 394991047, - "node1": 3978753087, - "node2": 3978753092 - }, - { - "osm_way_id": 394991043, - "node1": 3978753110, - "node2": 3978753097 - }, - { - "osm_way_id": 394991047, - "node1": 3978753107, - "node2": 3978753097 - }, - { - "osm_way_id": 394991047, - "node1": 3978753096, - "node2": 3978753105 - }, - { - "osm_way_id": 394991044, - "node1": 3978753107, - "node2": 3978753110 - }, - { - "osm_way_id": 394991048, - "node1": 3978753110, - "node2": 3978753099 - }, - { - "osm_way_id": 394991047, - "node1": 3978753095, - "node2": 3978753096 - }, - { - "osm_way_id": 394991047, - "node1": 3978753092, - "node2": 3978753095 - }, - { - "osm_way_id": 394991047, - "node1": 3978753105, - "node2": 3978753107 - }, - { - "osm_way_id": 158782115, - "node1": 1709142313, - "node2": 1709142595 - }, - { - "osm_way_id": 6495804, - "node1": 1709142595, - "node2": 53230466 - }, - { - "osm_way_id": 6495792, - "node1": 53214349, - "node2": 1709141381 - }, - { - "osm_way_id": 158782115, - "node1": 1709142353, - "node2": 1709141381 - }, - { - "osm_way_id": 158780999, - "node1": 1709142353, - "node2": 53096943 - }, - { - "osm_way_id": 158782115, - "node1": 1709142595, - "node2": 1709142353 - }, - { - "osm_way_id": 158782115, - "node1": 1709141381, - "node2": 1709141982 - }, - { - "osm_way_id": 158782115, - "node1": 1709141982, - "node2": 1709142313 - } - ], - "delete_intersections": [ - { - "osm_node_id": 3978753087 - }, - { - "osm_node_id": 3978753097 - }, - { - "osm_node_id": 3978753096 - }, - { - "osm_node_id": 3978753092 - }, - { - "osm_node_id": 3978753107 - }, - { - "osm_node_id": 1709142353 - }, - { - "osm_node_id": 1709142595 - }, - { - "osm_node_id": 1709141381 - }, - { - "osm_node_id": 1709142313 - } - ], - "add_intersections": [ - { - "point": { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - "intersection_type": "StopSign", - "label": null, - "orig_id": { - "osm_node_id": -1569791120 - }, - "synthetic": true - } - ], - "add_roads": [ - { - "i1": 389, - "i2": 64, - "center_points": [ - { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - { - "inner_x": 798.6749, - "inner_y": 861.2825 - } - ], - "orig_id": { - "osm_way_id": -1569791128, - "node1": -1569791120, - "node2": 3978753110 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791128", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/ds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 389, - "i2": 84, - "center_points": [ - { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - { - "inner_x": 786.3408, - "inner_y": 879.8966 - } - ], - "orig_id": { - "osm_way_id": -1569791130, - "node1": -1569791120, - "node2": 3978753099 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791130", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/ds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 389, - "i2": 205, - "center_points": [ - { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - { - "inner_x": 829.4053, - "inner_y": 872.1018 - } - ], - "orig_id": { - "osm_way_id": -1569791132, - "node1": -1569791120, - "node2": 3978753105 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791132", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/ds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 389, - "i2": 103, - "center_points": [ - { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - { - "inner_x": 844.6918, - "inner_y": 882.2317 - } - ], - "orig_id": { - "osm_way_id": -1569791134, - "node1": -1569791120, - "node2": 3978753095 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791134", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/ds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 389, - "i2": 111, - "center_points": [ - { - "inner_x": 813.9379, - "inner_y": 886.5756 - }, - { - "inner_x": 859.806, - "inner_y": 904.4373 - } - ], - "orig_id": { - "osm_way_id": -1569791135, - "node1": -1569791120, - "node2": 2499822233 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791135", - "abst:synthetic": "true", - "abst:synthetic_lanes": "ds/ds", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 155, - "i2": 31, - "center_points": [ - { - "inner_x": 1670.7776, - "inner_y": 1507.9477 - }, - { - "inner_x": 1674.2845, - "inner_y": 1066.6373 - } - ], - "orig_id": { - "osm_way_id": -1569791601, - "node1": 1709141982, - "node2": 53230466 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791601", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 337, - "i2": 155, - "center_points": [ - { - "inner_x": 1642.3402, - "inner_y": 1646.9859 - }, - { - "inner_x": 1670.7776, - "inner_y": 1507.9477 - } - ], - "orig_id": { - "osm_way_id": -1569791614, - "node1": 53214349, - "node2": 1709141982 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791614", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - }, - { - "i1": 112, - "i2": 155, - "center_points": [ - { - "inner_x": 1583.0525, - "inner_y": 1389.7475 - }, - { - "inner_x": 1670.7776, - "inner_y": 1507.9477 - } - ], - "orig_id": { - "osm_way_id": -1569791620, - "node1": 53096943, - "node2": 1709141982 - }, - "osm_tags": { - "abst:endpt_back": "true", - "abst:endpt_fwd": "true", - "abst:osm_way_id": "-1569791620", - "abst:synthetic": "true", - "abst:synthetic_lanes": "dps/dps", - "maxspeed": "25 mph", - "name": "Streety McStreetFace" - }, - "turn_restrictions": [] - } - ], - "merge_short_roads": [ - { - "osm_way_id": 256990067, - "node1": 542743474, - "node2": 53207165 - } - ] -} diff --git a/map_editor/src/main.rs b/map_editor/src/main.rs index 75521fe0d2..746f115e96 100644 --- a/map_editor/src/main.rs +++ b/map_editor/src/main.rs @@ -473,7 +473,7 @@ impl GUI for UI { .key_pressed(Key::Backspace, "delete everything in area") { if let Some(rect) = Polygon::rectangle_two_corners(pt1, *pt2) { - self.model.delete_everything_inside(rect, ctx.prerender); + self.model.delete_everything_inside(rect); self.model.world.handle_mouseover(ctx); } self.state = State::viewing(); diff --git a/map_editor/src/model.rs b/map_editor/src/model.rs index 46597a3202..f24f7966dc 100644 --- a/map_editor/src/model.rs +++ b/map_editor/src/model.rs @@ -7,7 +7,7 @@ use map_model::raw::{ RestrictionType, StableBuildingID, StableIntersectionID, StableRoadID, }; use map_model::{osm, IntersectionType, LaneType, RoadSpec, LANE_THICKNESS}; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; use std::mem; const INTERSECTION_RADIUS: Distance = Distance::const_meters(5.0); @@ -22,7 +22,6 @@ pub struct Model { pub world: World, include_bldgs: bool, - fixes: MapFixes, edit_fixes: Option, pub intersection_geom: bool, } @@ -35,7 +34,6 @@ impl Model { showing_pts: None, include_bldgs: false, - fixes: MapFixes::new(), edit_fixes: None, world: World::new(&Bounds::new()), intersection_geom: false, @@ -55,16 +53,14 @@ impl Model { model.include_bldgs = include_bldgs; model.edit_fixes = edit_fixes; model.map = read_binary(path, &mut timer).unwrap(); - model.fixes.gps_bounds = model.map.gps_bounds.clone(); model.intersection_geom = intersection_geom; if !no_fixes { - let mut all_fixes = MapFixes::load(&mut timer); + let all_fixes = MapFixes::load(&mut timer); model.map.apply_fixes(&all_fixes, &mut timer); if let Some(ref name) = model.edit_fixes { - if let Some(fixes) = all_fixes.remove(name) { - model.fixes = fixes; - if !model.fixes.gps_bounds.approx_eq(&model.map.gps_bounds) { + if let Some(fixes) = all_fixes.get(name) { + if !fixes.gps_bounds.approx_eq(&model.map.gps_bounds) { panic!("Can't edit {} with this map; use the original map", name); } } @@ -116,38 +112,14 @@ impl Model { return; }; - // It's easiest to just go back and detect all of the added roads and intersections. But we - // have to avoid picking up changes from other fixes. - // TODO Ideally fixes would have a Polygon of where they influence, and all of the polygons - // would be disjoint. Nothing prevents fixes from being saved in the wrong group, or a - // created road from one set to be deleted in another -- we're just sure that a fix isn't - // repeated. - let mut ignore_roads: BTreeSet = BTreeSet::new(); - let mut ignore_intersections: BTreeSet = BTreeSet::new(); - - for (n, f) in MapFixes::load(&mut Timer::throwaway()) { - if n != name { - let (r, i) = f.all_touched_ids(); - ignore_roads.extend(r); - ignore_intersections.extend(i); - } - } - - self.fixes.add_intersections.clear(); - self.fixes.add_roads.clear(); - for i in self.map.intersections.values() { - if i.synthetic && !ignore_intersections.contains(&i.orig_id) { - self.fixes.add_intersections.push(i.clone()); - } - } - for r in self.map.roads.values() { - if r.synthetic() && !ignore_roads.contains(&r.orig_id) { - self.fixes.add_roads.push(r.clone()); - } - } - let path = abstutil::path_fixes(&name); - abstutil::write_json(&path, &self.fixes).unwrap(); + abstutil::write_json( + &path, + &self + .map + .generate_fixes(&name, &mut Timer::new("calculate MapFixes")), + ) + .unwrap(); println!("Wrote {}", path); } @@ -169,7 +141,7 @@ impl Model { bounds } - pub fn delete_everything_inside(&mut self, area: Polygon, prerender: &Prerender) { + pub fn delete_everything_inside(&mut self, area: Polygon) { if self.include_bldgs { for id in self.map.buildings.keys().cloned().collect::>() { if area.contains_pt(self.map.buildings[&id].polygon.center()) { @@ -178,23 +150,15 @@ impl Model { } } - let mut delete_roads = Vec::new(); for id in self.map.roads.keys().cloned().collect::>() { if self.map.roads[&id] .center_points .iter() .any(|pt| area.contains_pt(*pt)) { - for (rt, to) in self.map.roads[&id].turn_restrictions.clone() { - self.delete_tr(id, rt, to, prerender); - } - - delete_roads.push(id); + self.delete_r(id); } } - for id in delete_roads { - self.delete_r(id); - } for id in self.map.intersections.keys().cloned().collect::>() { if area.contains_pt(self.map.intersections[&id].point) { @@ -294,7 +258,7 @@ impl Model { pub fn create_i(&mut self, point: Pt2D, prerender: &Prerender) { let id = self .map - .create_intersection(RawIntersection { + .override_intersection(RawIntersection { point, intersection_type: IntersectionType::StopSign, label: None, @@ -352,7 +316,7 @@ impl Model { println!("Can't delete intersection used by roads"); return; } - self.map.delete_intersection(id, &mut self.fixes); + self.map.delete_intersection(id); self.world.delete(ID::Intersection(id)); } } @@ -408,7 +372,7 @@ impl Model { let id = self .map - .create_road(RawRoad { + .override_road(RawRoad { i1, i2, orig_id: OriginalRoad { @@ -431,14 +395,12 @@ impl Model { self.road_deleted(id); if let Some(s) = RoadSpec::parse(spec.clone()) { - let mut osm_tags = self.map.roads[&id].osm_tags.clone(); - osm_tags.insert(osm::SYNTHETIC_LANES.to_string(), s.to_string()); - self.map.override_metadata( - id, - osm_tags, - self.map.roads[&id].turn_restrictions.clone(), - &mut self.fixes, - ); + self.map + .roads + .get_mut(&id) + .unwrap() + .osm_tags + .insert(osm::SYNTHETIC_LANES.to_string(), s.to_string()); } else { println!("Bad RoadSpec: {}", spec); } @@ -449,9 +411,9 @@ impl Model { pub fn swap_lanes(&mut self, id: StableRoadID, prerender: &Prerender) { self.road_deleted(id); - let (mut lanes, mut osm_tags) = { - let r = &self.map.roads[&id]; - (r.get_spec(), r.osm_tags.clone()) + let (mut lanes, osm_tags) = { + let r = self.map.roads.get_mut(&id).unwrap(); + (r.get_spec(), &mut r.osm_tags) }; mem::swap(&mut lanes.fwd, &mut lanes.back); osm_tags.insert(osm::SYNTHETIC_LANES.to_string(), lanes.to_string()); @@ -465,28 +427,20 @@ impl Model { osm_tags.insert(osm::FWD_LABEL.to_string(), l); } - self.map.override_metadata( - id, - osm_tags, - self.map.roads[&id].turn_restrictions.clone(), - &mut self.fixes, - ); self.road_added(id, prerender); } pub fn set_r_label(&mut self, r: StableRoadID, label: String, prerender: &Prerender) { self.road_deleted(r); - let mut osm_tags = self.map.roads[&r].osm_tags.clone(); // Always insert the forward label. Can fiddle with swap_lanes to change it. - osm_tags.insert(osm::FWD_LABEL.to_string(), label.to_string()); + self.map + .roads + .get_mut(&r) + .unwrap() + .osm_tags + .insert(osm::FWD_LABEL.to_string(), label.to_string()); - self.map.override_metadata( - r, - osm_tags, - self.map.roads[&r].turn_restrictions.clone(), - &mut self.fixes, - ); self.road_added(r, prerender); } @@ -500,17 +454,11 @@ impl Model { ) { self.road_deleted(id); - let mut osm_tags = self.map.roads[&id].osm_tags.clone(); + let osm_tags = &mut self.map.roads.get_mut(&id).unwrap().osm_tags; osm_tags.insert(osm::NAME.to_string(), name); osm_tags.insert(osm::MAXSPEED.to_string(), speed); osm_tags.insert(osm::HIGHWAY.to_string(), highway); - self.map.override_metadata( - id, - osm_tags, - self.map.roads[&id].turn_restrictions.clone(), - &mut self.fixes, - ); self.road_added(id, prerender); } @@ -560,7 +508,7 @@ impl Model { for id in matching_roads { self.road_deleted(id); - let mut osm_tags = self.map.roads[&id].osm_tags.clone(); + let osm_tags = &mut self.map.roads.get_mut(&id).unwrap().osm_tags; osm_tags.remove(osm::INFERRED_PARKING); let yes = "parallel".to_string(); let no = "no_parking".to_string(); @@ -579,12 +527,6 @@ impl Model { osm_tags.insert(osm::PARKING_BOTH.to_string(), yes); } - self.map.override_metadata( - id, - osm_tags, - self.map.roads[&id].turn_restrictions.clone(), - &mut self.fixes, - ); self.road_added(id, prerender); } } @@ -624,7 +566,7 @@ impl Model { for id in matching_roads { self.road_deleted(id); - let mut osm_tags = self.map.roads[&id].osm_tags.clone(); + let osm_tags = &mut self.map.roads.get_mut(&id).unwrap().osm_tags; osm_tags.remove(osm::INFERRED_SIDEWALKS); if value == Some("both".to_string()) { osm_tags.insert(osm::SIDEWALK.to_string(), "right".to_string()); @@ -636,26 +578,14 @@ impl Model { osm_tags.insert(osm::SIDEWALK.to_string(), "both".to_string()); } - self.map.override_metadata( - id, - osm_tags, - self.map.roads[&id].turn_restrictions.clone(), - &mut self.fixes, - ); self.road_added(id, prerender); } } pub fn delete_r(&mut self, id: StableRoadID) { self.stop_showing_pts(id); - - match self.map.can_delete_road(id) { - Ok(()) => { - self.road_deleted(id); - self.map.delete_road(id, &mut self.fixes); - } - Err(e) => println!("Can't delete this road: {}", e), - } + self.road_deleted(id); + self.map.delete_road(id); } fn road_objects(&self, id: StableRoadID) -> Vec> { @@ -797,9 +727,8 @@ impl Model { self.world.delete(ID::Intersection(self.map.roads[&id].i1)); self.world.delete(ID::Intersection(self.map.roads[&id].i2)); - let mut pts = self.map.roads[&id].center_points.clone(); + let pts = &mut self.map.roads.get_mut(&id).unwrap().center_points; pts[idx] = point; - self.map.override_road_points(id, pts); self.road_added(id, prerender); self.intersection_added(self.map.roads[&id].i1, prerender); @@ -815,9 +744,8 @@ impl Model { self.world.delete(ID::Intersection(self.map.roads[&id].i1)); self.world.delete(ID::Intersection(self.map.roads[&id].i2)); - let mut pts = self.map.roads[&id].center_points.clone(); + let pts = &mut self.map.roads.get_mut(&id).unwrap().center_points; pts.remove(idx); - self.map.override_road_points(id, pts); self.road_added(id, prerender); self.intersection_added(self.map.roads[&id].i1, prerender); @@ -833,8 +761,8 @@ impl Model { self.world.delete(ID::Intersection(self.map.roads[&id].i1)); self.world.delete(ID::Intersection(self.map.roads[&id].i2)); - let mut pts = self.map.roads[&id].center_points.clone(); let mut closest = FindClosest::new(&self.compute_bounds()); + let pts = &mut self.map.roads.get_mut(&id).unwrap().center_points; for (idx, pair) in pts.windows(2).enumerate() { closest.add(idx + 1, &vec![pair[0], pair[1]]); } @@ -845,7 +773,6 @@ impl Model { println!("Couldn't figure out where to insert new point"); None }; - self.map.override_road_points(id, pts); self.road_added(id, prerender); self.intersection_added(self.map.roads[&id].i1, prerender); @@ -868,8 +795,7 @@ impl Model { // of lanes and can generate all the IDs. self.road_deleted(id); - let (retained_i, deleted_i, changed_roads) = - self.map.merge_short_road(id, &mut self.fixes).unwrap(); + let (retained_i, deleted_i, changed_roads) = self.map.merge_short_road(id).unwrap(); self.world.delete(ID::Intersection(retained_i)); self.intersection_added(retained_i, prerender); @@ -896,8 +822,14 @@ impl Model { ) { self.road_deleted(from); + assert!(self.map.can_add_turn_restriction(from, to)); + // TODO Worry about dupes self.map - .add_turn_restriction(from, restriction, to, &mut self.fixes); + .roads + .get_mut(&from) + .unwrap() + .turn_restrictions + .push((restriction, to)); self.road_added(from, prerender); } @@ -912,7 +844,11 @@ impl Model { self.road_deleted(from); self.map - .delete_turn_restriction(from, restriction, to, &mut self.fixes); + .roads + .get_mut(&from) + .unwrap() + .turn_restrictions + .retain(|(this_r, this_to)| *this_r != restriction || *this_to != to); self.road_added(from, prerender); } diff --git a/map_model/src/raw.rs b/map_model/src/raw.rs index 03d2054393..94572cb8ca 100644 --- a/map_model/src/raw.rs +++ b/map_model/src/raw.rs @@ -1,6 +1,6 @@ use crate::make::get_lane_types; use crate::{osm, AreaType, IntersectionType, OffstreetParking, RoadSpec}; -use abstutil::{deserialize_btreemap, serialize_btreemap, Error, Timer}; +use abstutil::{Error, Timer}; use geom::{Distance, GPSBounds, Polygon, Pt2D}; use gtfs::Route; use serde_derive::{Deserialize, Serialize}; @@ -64,8 +64,7 @@ impl RawMap { } } - // TODO pub(crate) for these - pub fn find_r(&self, orig: OriginalRoad) -> Option { + fn find_r(&self, orig: OriginalRoad) -> Option { for (id, r) in &self.roads { if r.orig_id == orig { return Some(*id); @@ -74,7 +73,7 @@ impl RawMap { None } - pub fn find_i(&self, orig: OriginalIntersection) -> Option { + fn find_i(&self, orig: OriginalIntersection) -> Option { for (id, i) in &self.intersections { if i.orig_id == orig { return Some(*id); @@ -84,33 +83,14 @@ impl RawMap { } pub fn apply_fixes(&mut self, all_fixes: &BTreeMap, timer: &mut Timer) { - let mut dummy_fixes = MapFixes::new(); - timer.start("applying all fixes"); for (name, fixes) in all_fixes { let mut applied = 0; let mut skipped = 0; - // Do these first, because we're not allowed to delete roads if they have turn - // restrictions. - for (orig, (osm_tags, raw_restrictions)) in &fixes.override_metadata { - if let Some(r) = self.find_r(*orig) { - // If this road is in the map, it better not have any turn restrictions linking - // it to a road outside the map! - let restrictions = raw_restrictions - .iter() - .map(|(rt, to)| (*rt, self.find_r(*to).unwrap())) - .collect(); - self.override_metadata(r, osm_tags.clone(), restrictions, &mut dummy_fixes); - applied += 1; - } else { - skipped += 1; - } - } - for orig in &fixes.delete_roads { if let Some(r) = self.find_r(*orig) { - self.delete_road(r, &mut dummy_fixes); + self.delete_road(r); applied += 1; } else { skipped += 1; @@ -119,7 +99,7 @@ impl RawMap { for orig in &fixes.delete_intersections { if let Some(i) = self.find_i(*orig) { - self.delete_intersection(i, &mut dummy_fixes); + self.delete_intersection(i); applied += 1; } else { skipped += 1; @@ -128,7 +108,7 @@ impl RawMap { let remap_pts = !self.gps_bounds.approx_eq(&fixes.gps_bounds); - for mut i in fixes.add_intersections.clone() { + for mut i in fixes.override_intersections.clone() { if remap_pts { i.point = Pt2D::forcibly_from_gps( i.point.to_gps(&fixes.gps_bounds).unwrap(), @@ -136,30 +116,21 @@ impl RawMap { ); } - if self.create_intersection(i).is_some() { + if self.override_intersection(i).is_some() { applied += 1; } else { skipped += 1; } } - for mut r in fixes.add_roads.clone() { + for mut r in fixes.override_roads.clone() { if remap_pts { r.center_points = self .gps_bounds .forcibly_convert(&fixes.gps_bounds.must_convert_back(&r.center_points)); } - if self.create_road(r).is_some() { - applied += 1; - } else { - skipped += 1; - } - } - - for orig in &fixes.merge_short_roads { - if let Some(r) = self.find_r(*orig) { - self.merge_short_road(r, &mut dummy_fixes); + if self.override_road(r).is_some() { applied += 1; } else { skipped += 1; @@ -177,7 +148,6 @@ impl RawMap { } // TODO Might be better to maintain this instead of doing a search everytime. - // TODO make private pub fn roads_per_intersection(&self, i: StableIntersectionID) -> Vec { let mut results = Vec::new(); for (id, r) in &self.roads { @@ -265,69 +235,82 @@ impl RawMap { } } -// Mutations +// Mutations and supporting queries impl RawMap { - pub fn can_delete_road(&self, r: StableRoadID) -> Result<(), Error> { + pub fn delete_road(&mut self, r: StableRoadID) { + // First delete and warn about turn restrictions if !self.roads[&r].turn_restrictions.is_empty() { - return Err(Error::new(format!("{} has turn restrictions from it", r))); + println!("Deleting {}, but note it has turn restrictions from it", r); } // Brute force search the other direction + let mut cleanup_other_roads = Vec::new(); for (src, road) in &self.roads { for (_, to) in &road.turn_restrictions { if r == *to { - return Err(Error::new(format!( - "There's a turn restriction from {} to {}", - src, r - ))); + println!( + "Deleting turn restriction from other road {} to {}", + src, to + ); + cleanup_other_roads.push(*src); } } } - Ok(()) - } + for src in cleanup_other_roads { + self.roads + .get_mut(&src) + .unwrap() + .turn_restrictions + .retain(|(_, to)| *to != r); + } - pub fn delete_road(&mut self, r: StableRoadID, fixes: &mut MapFixes) { - if let Err(e) = self.can_delete_road(r) { - panic!("Can't delete_road {:?}: {}", self.roads[&r].orig_id, e); - } - let road = self.roads.remove(&r).unwrap(); - if !road.synthetic() { - fixes.delete_roads.push(road.orig_id); - } + self.roads.remove(&r).unwrap(); } pub fn can_delete_intersection(&self, i: StableIntersectionID) -> bool { self.roads_per_intersection(i).is_empty() } - pub fn delete_intersection(&mut self, id: StableIntersectionID, fixes: &mut MapFixes) { + pub fn delete_intersection(&mut self, id: StableIntersectionID) { if !self.can_delete_intersection(id) { panic!( "Can't delete_intersection {:?}, must have roads connected", self.intersections[&id].orig_id ); } - let i = self.intersections.remove(&id).unwrap(); - if !i.synthetic { - fixes.delete_intersections.push(i.orig_id); - } + self.intersections.remove(&id).unwrap(); } - pub fn create_intersection(&mut self, i: RawIntersection) -> Option { - assert!(i.synthetic); + // These two are kind of just for apply_fixes, except they're also useful to create new stuff, + // since they allocate a new ID. + pub fn override_intersection(&mut self, i: RawIntersection) -> Option { + // Existing? + if let Some(id) = self.find_i(i.orig_id) { + self.intersections.insert(id, i); + return Some(id); + } + + // New if self .gps_bounds .contains(i.point.forcibly_to_gps(&self.gps_bounds)) { let id = StableIntersectionID(self.intersections.keys().max().unwrap().0 + 1); - self.intersections.insert(id, i.clone()); + self.intersections.insert(id, i); Some(id) } else { None } } - pub fn create_road(&mut self, mut r: RawRoad) -> Option { - assert!(r.synthetic()); + pub fn override_road(&mut self, mut r: RawRoad) -> Option { + // Existing? + if let Some(id) = self.find_r(r.orig_id) { + // TODO Do we need to rewrite i1 and i2? + self.roads.insert(id, r); + return Some(id); + } + + // New match ( self.find_i(OriginalIntersection { osm_node_id: r.orig_id.node1, @@ -348,8 +331,6 @@ impl RawMap { } pub fn can_merge_short_road(&self, id: StableRoadID) -> Result<(), Error> { - self.can_delete_road(id)?; - let road = &self.roads[&id]; let i1 = &self.intersections[&road.i1]; let i2 = &self.intersections[&road.i2]; @@ -359,23 +340,6 @@ impl RawMap { return Err(Error::new(format!("{} touches a border", id))); } - for r in self.roads_per_intersection(road.i2) { - if self.roads[&r].synthetic() { - return Err(Error::new(format!( - "Surviving {} touches a synthetic road", - r - ))); - } - } - if i1.synthetic || i2.synthetic { - return Err(Error::new(format!( - "{} touches a synthetic intersection", - id - ))); - } - // It's fine if we're overriding the metadata for this road already; we'll just delete it - // if so. We might be forced to do that to delete turn restrictions. ;) - Ok(()) } @@ -384,7 +348,6 @@ impl RawMap { pub fn merge_short_road( &mut self, id: StableRoadID, - fixes: &mut MapFixes, ) -> Option<( StableIntersectionID, StableIntersectionID, @@ -392,9 +355,7 @@ impl RawMap { )> { assert!(self.can_merge_short_road(id).is_ok()); let (i1, i2) = { - let r = self.roads.remove(&id).unwrap(); - fixes.merge_short_roads.push(r.orig_id); - fixes.override_metadata.remove(&r.orig_id); + let r = &self.roads[&id]; (r.i1, r.i2) }; let (i1_pt, i1_orig_id) = { @@ -402,9 +363,12 @@ impl RawMap { (i.point, i.orig_id) }; + self.delete_road(id); + // Arbitrarily keep i1 and destroy i2. If the intersection types differ, upgrade the // surviving interesting. { + // Don't use delete_intersection; we're manually fixing up connected roads let i = self.intersections.remove(&i2).unwrap(); if i.intersection_type == IntersectionType::TrafficSignal { self.intersections.get_mut(&i1).unwrap().intersection_type = @@ -442,50 +406,6 @@ impl RawMap { Some((i1, i2, fixed)) } - pub fn override_metadata( - &mut self, - r: StableRoadID, - osm_tags: BTreeMap, - restrictions: Vec<(RestrictionType, StableRoadID)>, - fixes: &mut MapFixes, - ) { - { - let road = self.roads.get_mut(&r).unwrap(); - road.osm_tags = osm_tags; - road.turn_restrictions = restrictions; - } - - let road = &self.roads[&r]; - if !road.synthetic() { - fixes.override_metadata.insert( - road.orig_id, - ( - road.osm_tags.clone(), - road.turn_restrictions - .iter() - .map(|(rt, to)| (*rt, self.roads[to].orig_id)) - .collect(), - ), - ); - } - } - - pub fn delete_turn_restriction( - &mut self, - from: StableRoadID, - restriction: RestrictionType, - to: StableRoadID, - fixes: &mut MapFixes, - ) { - let (osm_tags, mut restrictions) = { - let r = &self.roads[&from]; - (r.osm_tags.clone(), r.turn_restrictions.clone()) - }; - restrictions.retain(|(this_r, this_to)| *this_r != restriction || *this_to != to); - - self.override_metadata(from, osm_tags, restrictions, fixes); - } - pub fn can_add_turn_restriction(&self, from: StableRoadID, to: StableRoadID) -> bool { let (i1, i2) = { let r = &self.roads[&from]; @@ -498,33 +418,11 @@ impl RawMap { i1 == i3 || i1 == i4 || i2 == i3 || i2 == i4 } - // TODO Worry about duplicates? - pub fn add_turn_restriction( - &mut self, - from: StableRoadID, - restriction: RestrictionType, - to: StableRoadID, - fixes: &mut MapFixes, - ) { - assert!(self.can_add_turn_restriction(from, to)); - let (osm_tags, mut restrictions) = { - let r = &self.roads[&from]; - (r.osm_tags.clone(), r.turn_restrictions.clone()) - }; - restrictions.push((restriction, to)); - self.override_metadata(from, osm_tags, restrictions, fixes); - } -} - -// Mutations not recorded in MapFixes yet -// TODO Fix that! -impl RawMap { pub fn move_intersection( &mut self, id: StableIntersectionID, point: Pt2D, ) -> Option> { - // TODO Only for synthetic intersections, right? self.intersections.get_mut(&id).unwrap().point = point; // Update all the roads. @@ -537,12 +435,15 @@ impl RawMap { } else { assert_eq!(road.i2, id); *road.center_points.last_mut().unwrap() = point; + // TODO Don't update orig_id, right? } } Some(fixed) } + // TODO Some of these are pretty silly + pub fn modify_intersection( &mut self, id: StableIntersectionID, @@ -554,11 +455,6 @@ impl RawMap { i.label = label; } - // This shouldn't modify the endpoints, so don't have to mess around with intersections. - pub fn override_road_points(&mut self, id: StableRoadID, pts: Vec) { - self.roads.get_mut(&id).unwrap().center_points = pts; - } - pub fn create_building(&mut self, bldg: RawBuilding) -> Option { if bldg.polygon.center().to_gps(&self.gps_bounds).is_some() { let id = StableBuildingID(self.buildings.keys().max().unwrap().0 + 1); @@ -583,9 +479,82 @@ impl RawMap { pub fn delete_building(&mut self, id: StableBuildingID) { self.buildings.remove(&id); } + + pub fn generate_fixes(&self, fixes_name: &str, timer: &mut Timer) -> MapFixes { + let orig: RawMap = + abstutil::read_binary(&abstutil::path_raw_map(&self.name), timer).unwrap(); + + let mut fixes = MapFixes { + gps_bounds: self.gps_bounds.clone(), + delete_roads: Vec::new(), + delete_intersections: Vec::new(), + override_intersections: Vec::new(), + override_roads: Vec::new(), + }; + + // What'd we delete? + for r in orig.roads.values() { + if self.find_r(r.orig_id).is_none() { + fixes.delete_roads.push(r.orig_id); + } + } + for i in orig.intersections.values() { + if self.find_i(i.orig_id).is_none() { + fixes.delete_intersections.push(i.orig_id); + } + } + + // What'd we create or modify? + for i in self.intersections.values() { + if orig + .find_i(i.orig_id) + .map(|id| orig.intersections[&id] != *i) + .unwrap_or(true) + { + fixes.override_intersections.push(i.clone()); + } + } + for r in self.roads.values() { + if orig + .find_r(r.orig_id) + .map(|id| orig.roads[&id] != *r) + .unwrap_or(true) + { + fixes.override_roads.push(r.clone()); + } + } + + // Filter out things from other fixes. + // TODO If we accidentally modify something from another set of fixes, then we silently + // discard that change. Oops! + let mut seen_roads = BTreeSet::new(); + let mut seen_intersections = BTreeSet::new(); + for name in abstutil::list_all_objects("fixes", "") { + if name == fixes_name { + continue; + } + let f: MapFixes = abstutil::read_json(&abstutil::path_fixes(&name), timer).unwrap(); + let (new_roads, new_intersections) = f.all_touched_ids(); + seen_roads.extend(new_roads); + seen_intersections.extend(new_intersections); + } + + fixes.delete_roads.retain(|r| !seen_roads.contains(r)); + fixes + .delete_intersections + .retain(|i| !seen_intersections.contains(i)); + fixes + .override_intersections + .retain(|i| !seen_intersections.contains(&i.orig_id)); + fixes + .override_roads + .retain(|r| !seen_roads.contains(&r.orig_id)); + + fixes + } } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RawRoad { // The first and last point may not match up with i1 and i2. pub i1: StableIntersectionID, @@ -611,7 +580,7 @@ impl RawRoad { } } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RawIntersection { // Represents the original place where OSM center-lines meet. This is meaningless beyond // RawMap; roads and intersections get merged and deleted. @@ -690,38 +659,15 @@ pub struct OriginalIntersection { pub struct MapFixes { // Any Pt2Ds in the rest of the fixes are relative to these GPSBounds. pub gps_bounds: GPSBounds, - // For non-synthetic (original OSM) roads. (OSM tags, turn restrictions). - #[serde( - serialize_with = "serialize_btreemap", - deserialize_with = "deserialize_btreemap" - )] - pub override_metadata: BTreeMap< - OriginalRoad, - ( - BTreeMap, - Vec<(RestrictionType, OriginalRoad)>, - ), - >, + pub delete_roads: Vec, pub delete_intersections: Vec, - pub add_intersections: Vec, - pub add_roads: Vec, - pub merge_short_roads: Vec, + // Create or modify + pub override_intersections: Vec, + pub override_roads: Vec, } impl MapFixes { - pub fn new() -> MapFixes { - MapFixes { - gps_bounds: GPSBounds::new(), - delete_roads: Vec::new(), - delete_intersections: Vec::new(), - add_intersections: Vec::new(), - add_roads: Vec::new(), - merge_short_roads: Vec::new(), - override_metadata: BTreeMap::new(), - } - } - // The groups of fixes should be applicable in any order, theoretically... pub fn load(timer: &mut Timer) -> BTreeMap { // Make sure different groups of fixes don't conflict. @@ -754,17 +700,15 @@ impl MapFixes { results } - pub fn all_touched_ids(&self) -> (BTreeSet, BTreeSet) { + fn all_touched_ids(&self) -> (BTreeSet, BTreeSet) { let mut roads: BTreeSet = self.delete_roads.iter().cloned().collect(); - for r in &self.add_roads { + for r in &self.override_roads { roads.insert(r.orig_id); } - roads.extend(self.merge_short_roads.clone()); - roads.extend(self.override_metadata.keys().cloned()); let mut intersections: BTreeSet = self.delete_intersections.iter().cloned().collect(); - for i in &self.add_intersections { + for i in &self.override_intersections { intersections.insert(i.orig_id); }