mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
use traffic signal data from new kml, not old shp that's no longer online
This commit is contained in:
parent
5406593843
commit
149758d5ae
@ -17,6 +17,5 @@ ordered-float = "0.5.0"
|
|||||||
osm-xml = "0.5.1"
|
osm-xml = "0.5.1"
|
||||||
map_model = { path = "../map_model" }
|
map_model = { path = "../map_model" }
|
||||||
pretty_assertions = "0.5.1"
|
pretty_assertions = "0.5.1"
|
||||||
shp = "0.1.1"
|
|
||||||
sim = { path = "../sim" }
|
sim = { path = "../sim" }
|
||||||
structopt = "0.2"
|
structopt = "0.2"
|
||||||
|
@ -10,7 +10,6 @@ extern crate kml;
|
|||||||
extern crate map_model;
|
extern crate map_model;
|
||||||
extern crate ordered_float;
|
extern crate ordered_float;
|
||||||
extern crate osm_xml;
|
extern crate osm_xml;
|
||||||
extern crate shp;
|
|
||||||
// TODO To serialize Neighborhoods. Should probably lift this into the map_model layer instead of
|
// TODO To serialize Neighborhoods. Should probably lift this into the map_model layer instead of
|
||||||
// have this weird dependency.
|
// have this weird dependency.
|
||||||
extern crate sim;
|
extern crate sim;
|
||||||
@ -23,7 +22,6 @@ mod osm;
|
|||||||
mod remove_disconnected;
|
mod remove_disconnected;
|
||||||
mod split_ways;
|
mod split_ways;
|
||||||
mod srtm;
|
mod srtm;
|
||||||
mod traffic_signals;
|
|
||||||
|
|
||||||
use dimensioned::si;
|
use dimensioned::si;
|
||||||
use geom::{GPSBounds, PolyLine, Pt2D};
|
use geom::{GPSBounds, PolyLine, Pt2D};
|
||||||
@ -46,7 +44,7 @@ pub struct Flags {
|
|||||||
#[structopt(long = "elevation")]
|
#[structopt(long = "elevation")]
|
||||||
pub elevation: String,
|
pub elevation: String,
|
||||||
|
|
||||||
/// SHP with traffic signals
|
/// KML with traffic signals
|
||||||
#[structopt(long = "traffic_signals")]
|
#[structopt(long = "traffic_signals")]
|
||||||
pub traffic_signals: String,
|
pub traffic_signals: String,
|
||||||
|
|
||||||
@ -105,10 +103,16 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
|
|||||||
}
|
}
|
||||||
group_parcels::group_parcels(&gps_bounds, &mut map.parcels);
|
group_parcels::group_parcels(&gps_bounds, &mut map.parcels);
|
||||||
|
|
||||||
for pt in traffic_signals::extract(&flags.traffic_signals)
|
for shape in kml::load(&flags.traffic_signals, &gps_bounds, timer)
|
||||||
.expect("loading traffic signals failed")
|
.expect("loading traffic signals failed")
|
||||||
|
.shapes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
{
|
{
|
||||||
|
// See https://www.seattle.gov/Documents/Departments/SDOT/GIS/Traffic_Signals_OD.pdf
|
||||||
|
if shape.points.len() > 1 {
|
||||||
|
panic!("Traffic signal has multiple points: {:?}", shape);
|
||||||
|
}
|
||||||
|
let pt = shape.points[0];
|
||||||
if gps_bounds.contains(pt) {
|
if gps_bounds.contains(pt) {
|
||||||
let distance = |i: &raw_data::Intersection| pt.gps_dist_meters(i.point);
|
let distance = |i: &raw_data::Intersection| pt.gps_dist_meters(i.point);
|
||||||
|
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
use geom::LonLat;
|
|
||||||
use shp;
|
|
||||||
use std;
|
|
||||||
use std::io::Error;
|
|
||||||
|
|
||||||
// Returns the location of traffic signals
|
|
||||||
pub fn extract(path: &str) -> Result<Vec<LonLat>, Error> {
|
|
||||||
println!("Opening {}", path);
|
|
||||||
|
|
||||||
let reader = shp::ShpReader::open(path)?;
|
|
||||||
let file = reader.read();
|
|
||||||
let mut result: Vec<LonLat> = Vec::new();
|
|
||||||
for r in &file.records {
|
|
||||||
if let shp::ShpRecordContent::MultiPoint(ref raw_shape) = r.content {
|
|
||||||
// The shp crate doesn't expose the struct fields as public. Send a PR later, do this
|
|
||||||
// workaround for now.
|
|
||||||
let shape = unsafe {
|
|
||||||
std::mem::transmute::<&shp::MultiPointShape, &MultiPointShape>(raw_shape)
|
|
||||||
};
|
|
||||||
// Some intersections have multiple points, which shows complicated intersections. For
|
|
||||||
// now, don't handle these.
|
|
||||||
result.push(LonLat::new(shape.points[0].x, shape.points[0].y));
|
|
||||||
} else {
|
|
||||||
println!("Unexpected shp record: {:?}", r.content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
struct PointShape {
|
|
||||||
x: f64,
|
|
||||||
y: f64,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MultiPointShape {
|
|
||||||
_xmin: f64,
|
|
||||||
_xmax: f64,
|
|
||||||
_ymin: f64,
|
|
||||||
_ymax: f64,
|
|
||||||
_num_points: i32,
|
|
||||||
points: Vec<PointShape>,
|
|
||||||
}
|
|
@ -1,5 +1,9 @@
|
|||||||
# Intersection-related design notes
|
# Intersection-related design notes
|
||||||
|
|
||||||
|
## Nice diagrams
|
||||||
|
|
||||||
|
http://streetsillustrated.seattle.gov/design-standards/intersections/pedcrossing/
|
||||||
|
|
||||||
## Stop sign editor
|
## Stop sign editor
|
||||||
|
|
||||||
Stop signs are FIFO, except that many intersections only have a stop sign for
|
Stop signs are FIFO, except that many intersections only have a stop sign for
|
||||||
@ -30,6 +34,12 @@ visually.
|
|||||||
- could draw an unaligned signal box with 3 circles in the middle of the intersection, but what does it represent? maybe just an initial indicator of what's going on; not full detail.
|
- could draw an unaligned signal box with 3 circles in the middle of the intersection, but what does it represent? maybe just an initial indicator of what's going on; not full detail.
|
||||||
- similarly, draw a single stop sign in the middle of other intersections? :P
|
- similarly, draw a single stop sign in the middle of other intersections? :P
|
||||||
|
|
||||||
|
- http://streetsillustrated.seattle.gov/design-standards/intersections/its/ probably has hints on cycle duration
|
||||||
|
- https://ops.fhwa.dot.gov/publications/fhwahop08024/chapter4.htm
|
||||||
|
- ring and barrier diagrams
|
||||||
|
- https://www.webpages.uidaho.edu/TrafficSignalSystems/traffic/instructor/ch3a.pdf
|
||||||
|
- http://iamtraffic.org/evaluation/the-six-way/
|
||||||
|
|
||||||
## Intersection policies for pedestrians ##
|
## Intersection policies for pedestrians ##
|
||||||
|
|
||||||
Before figuring out how pedestrians will deterministically use intersections alongside cars, recall how cars currently work...
|
Before figuring out how pedestrians will deterministically use intersections alongside cars, recall how cars currently work...
|
||||||
|
12
import.sh
12
import.sh
@ -29,13 +29,11 @@ if [ ! -d data/input/google_transit_2018_18_08/ ]; then
|
|||||||
rm -f data/input/google_transit_2018_18_08.zip;
|
rm -f data/input/google_transit_2018_18_08.zip;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f data/input/TrafficSignals.shp ]; then
|
if [ ! -f data/input/traffic_signals.kml ]; then
|
||||||
|
# From https://data.seattle.gov/Transportation/Traffic-Signals/nr6x-wnd5
|
||||||
get_if_needed \
|
get_if_needed \
|
||||||
https://data.seattle.gov/download/dr6d-ejex/application%2Fzip \
|
http://data-seattlecitygis.opendata.arcgis.com/datasets/ff97a6eb8ac84356beea09138c6e1ec3_0.kml \
|
||||||
data/input/TrafficSignals.shp.zip;
|
data/input/traffic_signals.kml;
|
||||||
unzip -d data/input data/input/TrafficSignals.shp.zip;
|
|
||||||
mv data/input/Traffic\ Signals/WGS84/TrafficSignals.shp data/input;
|
|
||||||
rm -rf data/input/Traffic\ Signals data/input/TrafficSignals.shp.zip;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f data/input/neighborhoods.geojson ]; then
|
if [ ! -f data/input/neighborhoods.geojson ]; then
|
||||||
@ -91,7 +89,7 @@ for poly in `ls ../data/polygons/`; do
|
|||||||
cargo run --release -- \
|
cargo run --release -- \
|
||||||
--osm=../data/input/$name.osm \
|
--osm=../data/input/$name.osm \
|
||||||
--elevation=../data/input/N47W122.hgt \
|
--elevation=../data/input/N47W122.hgt \
|
||||||
--traffic_signals=../data/input/TrafficSignals.shp \
|
--traffic_signals=../data/input/traffic_signals.kml \
|
||||||
--parcels=../data/shapes/parcels \
|
--parcels=../data/shapes/parcels \
|
||||||
--parking_shapes=../data/shapes/blockface \
|
--parking_shapes=../data/shapes/blockface \
|
||||||
--gtfs=../data/input/google_transit_2018_18_08 \
|
--gtfs=../data/input/google_transit_2018_18_08 \
|
||||||
|
@ -33,7 +33,7 @@ pub struct ExtraShapes {
|
|||||||
pub shapes: Vec<ExtraShape>,
|
pub shapes: Vec<ExtraShape>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct ExtraShape {
|
pub struct ExtraShape {
|
||||||
pub points: Vec<LonLat>,
|
pub points: Vec<LonLat>,
|
||||||
pub attributes: BTreeMap<String, String>,
|
pub attributes: BTreeMap<String, String>,
|
||||||
|
@ -9,7 +9,7 @@ pub fn run(t: &mut TestRunner) {
|
|||||||
let flags = convert_osm::Flags {
|
let flags = convert_osm::Flags {
|
||||||
osm: "../data/input/montlake.osm".to_string(),
|
osm: "../data/input/montlake.osm".to_string(),
|
||||||
elevation: "../data/input/N47W122.hgt".to_string(),
|
elevation: "../data/input/N47W122.hgt".to_string(),
|
||||||
traffic_signals: "../data/input/TrafficSignals.shp".to_string(),
|
traffic_signals: "../data/input/traffic_signals.kml".to_string(),
|
||||||
parcels: "../data/shapes/parcels".to_string(),
|
parcels: "../data/shapes/parcels".to_string(),
|
||||||
parking_shapes: "../data/shapes/blockface".to_string(),
|
parking_shapes: "../data/shapes/blockface".to_string(),
|
||||||
gtfs: "../data/input/google_transit_2018_18_08".to_string(),
|
gtfs: "../data/input/google_transit_2018_18_08".to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user