Commit Graph

1670 Commits

Author SHA1 Message Date
Dustin Carlino
99747ff34e Make the LTN tool more robust to broken blockfinding. #841
Try the cheap validation first. If it breaks, fall back to the expensive
version.
2022-03-05 17:21:54 +00:00
Dustin Carlino
1ac25cc39a Find thick dual carriageway roads that overlap, and cut their width in
half.
2022-03-05 11:03:23 +00:00
Dustin Carlino
a421eaf900 Don't attempt to trace blocks around bridges/tunnels at all in Lyons, avoiding a crash there. #857 2022-03-01 15:24:59 +00:00
Dustin Carlino
cbfe2265bb When detecting existing filters in OSM, use the road length after the edit has been applied. Found in Leeds. 2022-03-01 13:02:29 +00:00
Dustin Carlino
23cf7c8d0c Detect incorrectly merged perimeters MUCH faster. #841 [rebuild] [release] 2022-02-26 20:24:32 +00:00
Dustin Carlino
460c03e75c Trace blocks starting from roads without sidewalks on both sides 2022-02-24 20:10:33 +00:00
Dustin Carlino
82dff217a5 When the lasso tool is active, change the panel to explain the interaction 2022-02-24 09:33:12 +00:00
Dustin Carlino
13f3a7af73 Add a tool to quickly expand an LTN boundary by freehand lasso. #857 2022-02-24 09:33:12 +00:00
Dustin Carlino
9c0aedb575 When we can help it, don't shift road polylines twice. #860 2022-02-23 18:46:42 +00:00
Dustin Carlino
2890e6efcc Make the RawMap APIs for working with road center-lines less obnoxious 2022-02-23 15:27:27 +00:00
Dustin Carlino
03b6f39763 Flatten the raw_map initial module now 2022-02-19 17:48:39 +00:00
Dustin Carlino
14bea3a4be Split out a raw_map crate from map_model. RawMap is the thing we turn
OSM and other raw input into and store, before later converting to a
Map.

Why?

- build-time performance: while iterating on geometry problems, map_editor in release mode took 33s to build before, 11s now that the crate is split
- better layering: operations on a RawMap are becoming increasingly distinct from later transformations on the bigger map model
- this helps tease apart the dependencies of the intersection polygon algorithm for #846
- this will make it simpler to cutover to osm2lanes for https://github.com/a-b-street/osm2lanes/issues/71

There's further reorganization in raw_map and map_model that'll follow,
but the main work is done here.
2022-02-19 17:39:28 +00:00
Dustin Carlino
6a5366292f Make editing maps with transit stops a little more resilient. #372
Transit stop IDs previously were tied to LaneIDs, but those can easily
change with edits to the number of lanes on a road. We still may need to
re-snap transit stops (if the driving position or sidewalk changes), but
this prevents one more common type of problem.

This requires regenerating everything, since it's a binary schema
change...
2022-02-17 20:18:24 +00:00
Dustin Carlino
0dc8972187 Fix editing maps that have public transit. #372
Back in #819, I broke things by creating the sidewalk+transit graph
before transit routes had been set up. This causes immediate crashing
when editing the 2 maps with transit (Arboretum and SF).
2022-02-17 19:35:46 +00:00
Dustin Carlino
9054666a0b Use RDP simplification to road center-lines when we glue them together after collapsing degenerate intersections. This is a followup to #833.
And clean up some other things that RDP does better.

Fallout from regenerating everything:

- Enfield borough crashed, so removed it
- All UK scenarios are now much bigger, due to the changes in #853 being
  picked up
- Poundbury gridlocks now due to that
2022-02-10 14:40:11 +00:00
Dustin Carlino
3de1ab3d9d Detect existing modal filters in OSM and represent them more directly. #851 2022-02-09 15:59:04 +00:00
Dustin Carlino
b06129da58 Add a way to temporarily flag off the slower blockfinding from #841 while working on maps that don't have the problem. 2022-02-04 10:07:54 +00:00
Dustin Carlino
e5704f4a6d Prevent many cases of blocks with overlapping geometry or that extend
too far, by not trying to trace near railways or cycle-only
bridges/tunnels. This is an imperfect heuristic, but it makes
significant progress in most maps.
2022-01-31 16:03:21 +00:00
Dustin Carlino
f8dfe32c04 Save LTN edits to files and load from CLI. No proper UI yet, and the
format isn't future-proof at all.
2022-01-31 13:30:55 +00:00
Dustin Carlino
e21c57b70a When calculating traffic volumes, deduplicate path requests first.
Around 2x less paths to calculate.

Even though the deduplication throws away some info, the net effect for
measuring traffic volumes is practically equivalent, so it's a
worthwhile optimization. Used the new comparison UI to verify that!
2022-01-27 14:26:36 +00:00
Dustin Carlino
dfbd9785f3 While merging adjacent perimeters for the LTN tool, don't proceed if
intermediate results can't be turned into a polygon. It'll break
something later. #841

There's a particular bug where a perimeter can be turned into a polygon,
but after collapsing internal dead-ends, it can't.

If we don't do this, the LTN select boundary UI crashes, and reasoning
about block -> neighborhood mappings gets very hairy. I'd like to
address all the root causes of failing to make a polygon, but until
then...

TRADE-OFF: it _really_ slows down the select boundary UI.
2022-01-25 18:12:15 +00:00
Dustin Carlino
eba579dbd1 Adjust the definition of cycleway roads to include sidewalks. Any road
with only bike lanes and any walkable lane counts as a cycleway, for
rendering purposes. So if you change a road with sidewalks to only allow
bikes on the road, it shows up green in the unzoomed layer.

There's lots of nuance with footways that doesn't matter yet, because
we're mostly not importing those yet.
2022-01-25 14:10:39 +00:00
Dustin Carlino
e36337a91f Use an enum for a more clear API to handle caching temporary
pathfinders. Should be no behavior changes yet
2022-01-23 09:37:45 +00:00
Dustin Carlino
1a05da2824 Change how pathfinding works when avoiding modal filters.
Before, it was just a large 3 hour penalty for crossing a filter -- so
it shouldn't happen, but it was possible, and so some (but not all!) LTN
code had an extra paranoia step to filter out paths that crossed.

Now, actually make it impossible at the pathfinding layer.

Also, fix colors in the LTN pathfinding tool that were backwards
2022-01-23 09:37:45 +00:00
Dustin Carlino
a14d6b3810 Better errors when core Line stuff breaks.
... and plumbing it everywhere
2022-01-18 10:26:33 +00:00
Dustin Carlino
3a60a465e0 Remove blocks from the current neighborhood, possibly creating a new one
The code is quite a mess, but it works...
2022-01-15 17:52:38 +00:00
Dustin Carlino
8ff4c41ea1 Some useful debugging / correctness steps towards more robust blockfinding. [rebuild] [release]
I have another branch that handles roads without sidewalks on one side
-- it helps in some cases, but regresses in others, so not merging it
yet. But taking a smaller step and bringing in some stricter common
endpoint logic from there.

Bringing in some useful intermediate changes
2022-01-09 11:07:10 +00:00
Dustin Carlino
85709b1e4f Workaround #834, which was causing partitioning to infinite loop when
there are disconnected railway segments dangling around
2022-01-06 13:25:16 +00:00
Dustin Carlino
cb3138dbfe When turning a perimeter into a block polygon, don't insist on tracing
along the perimeter of broken intersections.

There are cases where intersection geometry is a little bit broken,
jutting out a bit and touching a road. It's more robust to still produce
a reasonably shaped block in these cases, instead of totally give up.

Visual inspection and the goldenfile VASTLY improved!
2022-01-06 11:22:06 +00:00
Dustin Carlino
2356cee1db When tracing perimeters, allow doubling back at a dead-end with exactly
1 lane (usually a cycleway or footway). This correctly produces a few
more blocks in some maps -- as the goldenfile diff (and manual
verificaton) shows!

Also allow jumping from LTN browse to debug mode, to conveniently work
on blockfinding problems.
2022-01-06 10:16:11 +00:00
Dustin Carlino
8d0b891406 Prevent neighborhood_containing from crashing in North Leeds. [rebuild] [release] 2022-01-02 17:48:25 +00:00
Dustin Carlino
7d6f133f1c Make the LTN tool handle roads that already ban cars.
- Don't allow filtering them
- Don't cross them when calculating cell connectivity
- Create special green cells for them, and don't count towards the
  disconnected warning
2021-12-31 16:28:51 +00:00
Marcel Dejean
6691a28aae Delete the crosswalk at degenerate i's with sidewalks on one side 2021-12-28 00:05:12 +00:00
Dustin Carlino
bff9a8705b Use InfiniteLine::from_pt_angle in a few more places 2021-12-23 17:05:21 +00:00
Dustin Carlino
c8d88bd689 Make things build with the lyon_geom change 2021-12-23 17:00:08 +00:00
Marcel Dejean
72ae333218 switch from nbez to lyon_geom for bezier curves 2021-12-23 17:00:08 +00:00
Marcel Dejean
d1635904b5 make all turns using bezier curves
Straight turns and u turns where the angle of the turn is approx 0/180
have control points placed in an (approximate) 1:2 rectangle (u turn)
or a trapezoid (straight/offset/lane change turn). Other turns have
control points located 2/3 from the intersection of the from/to lane
centers, which is equivalent to a quadratic bezier with the control
point at the intersection.
2021-12-23 17:00:08 +00:00
Marcel Dejean
3bb3169ab4 use start/end line angle of the turn rather than line from start point to end point.
update uses of turn.angle() now that it's relative
2021-12-23 17:00:08 +00:00
Dustin Carlino
8aaeaabaec Never create turn geometry with broken PolyLines; it crashes calculate_curbs later in the UI. Hack around the problem in one place. Observed in Krakow (where we attempt to import all OSM footways). 2021-12-20 23:11:36 +00:00
Marcel Dejean
755c513b9f kill find_pts_between and simplify make_shared_sidewalk_corner 2021-12-20 23:11:36 +00:00
Marcel Dejean
933127f021 eliminate first_from - we go around just once 2021-12-20 23:11:36 +00:00
Marcel Dejean
52a26f8a12 Fix deadend sidewalk turns 2021-12-20 23:11:36 +00:00
Marcel Dejean
61a7d887d7 If there are exactly two crosswalks generated, delete one.
They must be connected by SharedSidewalkCorners.
2021-12-20 23:11:36 +00:00
Dustin Carlino
a3c5c6a27f Rebase and fix merge conflict 2021-12-20 23:11:36 +00:00
Marcel Dejean
273739a0e2 cleanup map 2021-12-20 23:11:36 +00:00
Marcel Dejean
babe6923b7 cleanup walking_turns 2021-12-20 23:11:36 +00:00
Marcel Dejean
cfe248fdab Include contraflow turns in get_turns_for, get_turns_from_lane,
Change get_next_turns_and_lanes (unused) to not take intersection, then fix uses of get_turns_from for sidewalks to use it

Add get_next_turns_and_lanes_for and use for floodfill
2021-12-20 23:11:36 +00:00
Marcel Dejean
9369ac229f Only make crosswalks in one direction.
Don't create duplicate crosswalks in edit_movement

Remove other_crosswalk_ids and switch to make_walking_turns_v2

Allow make_shared_sidewalk_corner and make_crosswalks to work in either direction with a point order check

Don't skip rendering some corners since they're no longer duplicated

Draw sidewalk corners the same regardless of lane direction with a point order check

Only make one crosswalk at dead ends and degenerate intersections

Make footways only get sharedsidewalkcorner turns

Don't panic on bad sharedsidewalkcorner geometry
2021-12-20 23:11:36 +00:00
Marcel Dejean
65f086ecb3 PathStep::ContraflowTurn to allow walking turns both ways
* Also implement ContraflowMovement for pathfinder v2
* Change uses of Turn to Turn | ContraflowTurn
* Reverse contraflowturn geometry when tracing pathstep
* Don't start or end a path in a ContraflowTurn either
2021-12-20 23:11:36 +00:00
Dustin Carlino
4e79d19765 Revert "When calculating LTN cells, don't cross bike-only roads."
This reverts commit 02420f920e.

Did not mean to push this yet, sorry!
2021-12-16 14:02:41 +00:00