acteng / atip

Active Travel Infrastructure Platform
https://acteng.github.io/atip/
Apache License 2.0
22 stars 4 forks source link

Add a gradient layer. #463 #475

Closed dabreegster closed 4 months ago

dabreegster commented 5 months ago

Demo at https://acteng.github.io/atip/gradient/browse.html. Enable "Other > Gradient" and zoom in. See https://github.com/acteng/atip-data-prep/pull/55 for details how this layer was generated.

Behavior at low zoom is poor; #326 still pending to rethink most layers there.

The arrows point uphill right now. In a previous project using the same visualization, people have been pretty split over what direction they should point. Any ideas for less ambiguous symbology?

I've checked some areas I know well, but if you know any big hills, it can't hurt to zoom in and sanity check the arrows and grade seem right.

robinlovelace-ate commented 5 months ago

Will take a look at this now.

robinlovelace-ate commented 5 months ago

Spot check 1: Buslingthorpe Lane is v. steep and is represented as such here so :+1: on that

image

robinlovelace-ate commented 5 months ago

A minor issue I've found with this is that small segments are sometimes out. In the slopes work I did with Rosa we introduced a normalisation factor for segments that were shorter than a given length, e.g. 10 m. The issue is that as you get to shorter lengths the calculation is more sensitive to quirks in the elevation estimation. See example below from the end of Harehills lane. There are 2 parallel lanes here that have pretty much the same gradient yet one is red while the other is green:

image

Could you introduce some kind of 'short segment normalisation'? We did that in slopes package using a lag so that for short links with unusual values we take the rolling mean of the gradient to avoid results being dominated by likely incorrect outliers like this. Example zoomed in on the errant link:

https://acteng.github.io/atip/gradient/browse.html?style=dataviz#20.69/53.8242227/-1.5315835

dabreegster commented 5 months ago

We did that in slopes package using a lag so that for short links with unusual values we take the rolling mean of the gradient to avoid results being dominated by likely incorrect outliers like this

Is this what you mean? https://github.com/ropensci/slopes/blob/91292bdd860f34deb364943067c9755a7bd97050/R/slopes.R#L75 I'm having trouble understanding this code. If we have a short LineString, is the suggestion to look at the optional LineString attached at each end if it was part of the same OSM way originally?

dabreegster commented 4 months ago

Thanks for review! We can improve the legend and handle short segments later.

I'll wait to merge until https://github.com/acteng/atip-data-prep/pull/55 is done and the file is in both GCS buckets too