basic installation instructions, and tweaks to scripts so that things

work better out-of-box
This commit is contained in:
Dustin Carlino 2019-01-10 20:56:15 -08:00
parent 2bc97fa609
commit d95099efbe
8 changed files with 44 additions and 27 deletions

View File

@ -161,6 +161,7 @@ fn is_road(tags: &BTreeMap<String, String>) -> bool {
// more discovered manually
"abandoned",
"elevator",
"planned",
] {
if tags.get("highway") == Some(&String::from(value)) {
return false;

View File

@ -1,16 +0,0 @@
# Project 23rd
I specifically want to play with traffic around 23rd Ave / 520. Some vague
things that should be easy to change:
- pedestrian scramble lights for walking between Montlake and Husky Stadium
- remove some left turns and see if traffic backs up so far
## The boundary
Vague text description: bit east of gasworks, 55th, 35th ave e, down around
madison, cherry st, cut to eastlake.
Different ways of specifying the boundary:
- listing major roads at the boundary, finding the polygon from that
- manually draw in UI, then somehow refine it to exclude leftover bits

23
docs/install.md Normal file
View File

@ -0,0 +1,23 @@
# Installation
I'm assuming a Linux-like environment with `bash`, `wget`, `unzip`, etc. The
import script also requires `osmosis` (on Ubuntu, `sudo apt-get install
osmosis` does the trick). In the future, I'll set up Github binary releases for
multiple platforms.
1. Install Rust, at least 1.31. https://www.rust-lang.org/tools/install
2. Download the repository: `git clone
https://github.com/dabreegster/abstreet.git`
3. Download all input data and build maps. Compilation times will be very
slow at first. `cd abstreet; ./import.sh`
4. Optional: Speed up map loading: `./precompute.sh`. Don't be alarmed if
many maps don't successfully convert.
## Running
There's a bit more to it, but the basics:
`cd editor; cargo run ../data/maps/montlake_no_edits.abst`

View File

@ -11,10 +11,14 @@ geom = { path = "../geom" }
log = "0.4.5"
ordered-float = "0.5.0"
palette = "0.4"
piston = "*"
piston2d-graphics = "*"
piston2d-opengl_graphics = "*"
pistoncore-glutin_window = "*"
piston = "0.37.0"
piston2d-graphics = "0.26.0"
piston2d-opengl_graphics = "0.53.0"
# Newer versions start reading DPI, which is very broken on my system.
# WINIT_HIDPI_FACTOR=1.0 as an environment variable fixes, but just pin to an
# older version for now... before
# https://github.com/tomaka/winit/commit/1b74822cfc0cb7fba4ed4940a3faae9499fcda95.
pistoncore-glutin_window = "0.47.0"
serde = "1.0"
serde_derive = "1.0"
textwrap = "0.11"

View File

@ -62,8 +62,7 @@ done
if [ ! -f data/shapes/parcels ]; then
# From https://gis-kingcounty.opendata.arcgis.com/datasets/king-county-parcels--parcel-area/geoservice
# TODO This isn't a direct link
#get_if_needed https://opendata.arcgis.com/datasets/8058a0c540434dadbe3ea0ade6565143_439.kml data/input/King_County_Parcels__parcel_area.kml;
get_if_needed https://opendata.arcgis.com/datasets/8058a0c540434dadbe3ea0ade6565143_439.kml data/input/King_County_Parcels__parcel_area.kml;
cd kml
time cargo run --release -- \

View File

@ -241,7 +241,8 @@ fn make_new_polygon(
if let Some((hit, angle)) = fwd_pl.intersection(adj_fwd_pl) {
// Find where the perpendicular to this corner hits the original line
let perp = Line::new(hit, hit.project_away(1.0, angle.rotate_degs(90.0)));
let trim_to = road_center.intersection_infinite_line(perp).unwrap();
// TODO This fails for something in the 23rd Ave map.
let trim_to = road_center.intersection_infinite_line(perp)?;
let mut c = road_center.clone();
c.trim_to_pt(trim_to);
(Some(hit), Some(c))
@ -253,7 +254,7 @@ fn make_new_polygon(
if let Some((hit, angle)) = back_pl.intersection(adj_back_pl) {
// Find where the perpendicular to this corner hits the original line
let perp = Line::new(hit, hit.project_away(1.0, angle.rotate_degs(90.0)));
let trim_to = road_center.intersection_infinite_line(perp).unwrap();
let trim_to = road_center.intersection_infinite_line(perp)?;
let mut c = road_center.clone();
c.trim_to_pt(trim_to);
(Some(hit), Some(c))

View File

@ -147,8 +147,7 @@ impl ControlTrafficSignal {
let straight_turn = map
.get_turns_in_intersection(i)
.into_iter()
.find(|t| t.turn_type == TurnType::Straight)
.unwrap();
.find(|t| t.turn_type == TurnType::Straight)?;
let (north, south) = (
map.get_l(straight_turn.id.src).parent,
map.get_l(straight_turn.id.dst).parent,

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
# If converting one map fails, keep converting other maps.
#set -e
release_mode=""
for arg in "$@"; do
@ -16,6 +17,11 @@ mkdir -p data/maps/
for map_path in `ls data/raw_maps/`; do
map=`basename $map_path .abst`;
echo "Precomputing $map with no_edits";
cd precompute;
cargo run $release_mode ../data/raw_maps/$map.abst --edits_name=no_edits;
cd ..;
if [ -e data/edits/$map ]; then
# Line based iteration, since filenames might have spaces
ls data/edits/$map/ | while read edit_path