Skip to content

Isochrone bugs #669

@dabreegster

Description

@dabreegster

@tnederlof, I've spotted at least 3 different existing bugs with the isochrones. Dumping the investigation here.

Problem 1: time to SidewalkEndpoints vs buildings

Repro: click any start point, go a few streets away, and hover over several buildings attached to the same sidewalk. I can find many examples where the time shown in the tooltip will increase/decrease in the wrong direction, or suddenly jump values.

The problem is

// Assign every building a cost based on which end of the sidewalk it's closest to
. We correctly visit SidewalkEndpoint nodes in increasing order. But then after we've produced the costs for those nodes, we have to somehow calculate the cost for each building. The current calculation will pick the SidewalkEndpoint that's closest to the building. But the problem is, that endpoint might not be the one closest to our start point! So in other words, the path that's happening in some cases looks like this:
Screenshot from 2021-06-08 14-57-27
The two circled buildings are closest to the intersection labelled 3. So the path cost we ultimately return reflects that "doubling back" weirdness.

The same bug doesn't happen if you switch to biking mode, because

for (b, road) in bldg_to_road {
doesn't attempt to fill in the extra detail of building distance along the sidewalk at all.

I'm working on a fix for this problem; it's hopefully simpler than the current implementation.

Problem 2: Contour polygons are wrong or cover stuff up

Screenshot from 2021-06-08 15-02-22
I would expect that any building in green that you hover on has a time <= 5 minutes, but this one is 6 minutes. I think the problem is how we map to grid cells: https://a-b-street.github.io/docs//side_projects/fifteen_min.html#drawing-the-isochrone
There's a physically nearby building with a much lower cost, and I think it happened to "win" here:

// Don't add! If two buildings map to the same cell, we should pick a finer resolution.

Even when buildings are physically close by, sometimes the cost to reach them is pretty different and happens to cross that threshold. Sometimes it's because they're on opposite sides of the street, and for bike paths, you have to do a convoluted thing right now to turn around and get on the proper side of the street.

Not sure what to do about this yet.

Problem 3: holes in the contour

Screenshot from 2021-06-08 15-06-19

This looks confusing / bad. It's because the contours library at the end of the day needs a grid, but our data is spatially sparse -- there are no buildings in the middle of a park/water.

There are actually two attempts elsewhere to deal with this. In the elevation contour map in the main game, we try to fill out every grid cell and just populate it with a value from the nearest matching point:

// Since gaps in the grid mess stuff up, just fill out each grid cell. Explicitly do the

And in the population heatmap, we can optionally "smooth" the grid:

if opts.smoothing {

Not sure what we should do for 15m. If we come up with a good technique, probably worth refactoring the 3 places and making Grid handle it directly?

I've googled around for a contouring algorithm that doesn't need a grid as input and can just use points, but I've only found things based on Marching Squares.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions