organizing data/input by city. (I tried organizing everything in data/,

but it's too big a change. small steps.)
This commit is contained in:
Dustin Carlino 2020-04-28 12:28:37 -07:00
parent bba8ac9941
commit 18779c10ad
30 changed files with 301 additions and 238 deletions

25
.gitignore vendored
View File

@ -1,20 +1,23 @@
/target/
*.swp
data/input/blockface.bin
data/input/google_transit
data/input/neighborhoods
data/input/neighborhoods.geojson
data/input/N47W122.hgt
data/input/offstreet_parking.bin
data/input/osm
data/input/parcels_urbansim.txt
data/input/popdat.bin
data/input/seattle/blockface.bin
data/input/seattle/google_transit
data/input/seattle/neighborhoods
data/input/seattle/neighborhoods.geojson
data/input/seattle/N47W122.hgt
data/input/seattle/offstreet_parking.bin
data/input/seattle/osm
data/input/seattle/parcels_urbansim.txt
data/input/seattle/popdat.bin
data/input/seattle/sidewalks.bin
data/input/seattle/trips_2014.csv
data/input/austin/osm
data/input/raw_maps
data/input/screenshots/*/*.png
data/input/screenshots/*/combine.sh
data/input/sidewalks.bin
data/input/trips_2014.csv
data/player

View File

@ -145,30 +145,31 @@ pub fn path_all_shortcuts() -> String {
// Input data (For developers to build maps, not needed at runtime)
pub fn path_fixes(name: &str) -> String {
format!("../data/input/fixes/{}.json", name)
pub fn path_fixes(city: &str, map: &str) -> String {
format!("../data/input/{}/fixes/{}.json", city, map)
}
pub fn path_neighborhood(map_name: &str, neighborhood: &str) -> String {
pub fn path_neighborhood(city_name: &str, map_name: &str, neighborhood: &str) -> String {
format!(
"../data/input/neighborhoods/{}/{}.json",
map_name, neighborhood
"../data/input/{}/neighborhoods/{}/{}.json",
city_name, map_name, neighborhood
)
}
pub fn path_all_neighborhoods(map_name: &str) -> String {
format!("../data/input/neighborhoods/{}", map_name)
pub fn path_all_neighborhoods(city_name: &str, map_name: &str) -> String {
format!("../data/input/{}/neighborhoods/{}", city_name, map_name)
}
pub fn path_pending_screenshots(map_name: &str) -> String {
format!("../data/input/screenshots/pending_{}", map_name)
}
pub fn path_polygon(polygon_name: &str) -> String {
format!("../data/input/polygons/{}.poly", polygon_name)
// TODO Few callers, and importer just manually builds this path anyway
pub fn path_polygon(city: &str, polygon_name: &str) -> String {
format!("../data/input/{}/polygons/{}.poly", city, polygon_name)
}
pub fn path_popdat() -> String {
format!("../data/input/popdat.bin")
format!("../data/input/seattle/popdat.bin")
}
pub fn path_raw_map(map_name: &str) -> String {

View File

@ -14,7 +14,11 @@ use map_model::raw::{DrivingSide, OriginalBuilding, OriginalRoad, RawMap};
const DIRECTED_ROAD_THICKNESS: Distance = Distance::const_meters(2.5);
pub struct Options {
pub osm: String,
pub osm_input: String,
pub output: String,
pub city_name: String,
pub name: String,
pub parking_shapes: Option<String>,
pub public_offstreet_parking: Option<String>,
pub private_offstreet_parking: PrivateOffstreetParking,
@ -24,7 +28,6 @@ pub struct Options {
pub elevation: Option<String>,
pub clip: Option<String>,
pub drive_on_right: bool,
pub output: String,
}
// If a building doesn't have anything from public_offstreet_parking, how many private spots should
@ -36,8 +39,16 @@ pub enum PrivateOffstreetParking {
}
pub fn convert(opts: Options, timer: &mut abstutil::Timer) -> RawMap {
let (mut map, amenities) =
split_ways::split_up_roads(osm_reader::extract_osm(&opts.osm, &opts.clip, timer), timer);
let (mut map, amenities) = split_ways::split_up_roads(
osm_reader::extract_osm(
&opts.osm_input,
&opts.clip,
&opts.city_name,
&opts.name,
timer,
),
timer,
);
clip::clip_map(&mut map, timer);
map.driving_side = if opts.drive_on_right {
DrivingSide::Right
@ -72,7 +83,12 @@ pub fn convert(opts: Options, timer: &mut abstutil::Timer) -> RawMap {
if let Some(ref path) = opts.neighborhoods {
timer.start("convert neighborhood polygons");
neighborhoods::convert(path.clone(), map.name.clone(), &map.gps_bounds);
neighborhoods::convert(
path.clone(),
map.city_name.clone(),
map.name.clone(),
&map.gps_bounds,
);
timer.stop("convert neighborhood polygons");
}

View File

@ -3,7 +3,7 @@ use geojson::{GeoJson, PolygonType, Value};
use geom::{GPSBounds, LonLat};
use map_model::NeighborhoodBuilder;
pub fn convert(geojson_path: String, map_name: String, gps_bounds: &GPSBounds) {
pub fn convert(geojson_path: String, city_name: String, map_name: String, gps_bounds: &GPSBounds) {
println!("Extracting neighborhoods from {}...", geojson_path);
let document: GeoJson = abstutil::read_json(geojson_path, &mut Timer::throwaway());
match document {
@ -12,13 +12,14 @@ pub fn convert(geojson_path: String, map_name: String, gps_bounds: &GPSBounds) {
let name = f.properties.unwrap()["name"].as_str().unwrap().to_string();
match f.geometry.unwrap().value {
Value::Polygon(p) => {
convert_polygon(p, name, map_name.clone(), gps_bounds);
convert_polygon(p, name, city_name.clone(), map_name.clone(), gps_bounds);
}
Value::MultiPolygon(polygons) => {
for (idx, p) in polygons.into_iter().enumerate() {
convert_polygon(
p,
format!("{} portion #{}", name, idx + 1),
city_name.clone(),
map_name.clone(),
gps_bounds,
);
@ -32,7 +33,13 @@ pub fn convert(geojson_path: String, map_name: String, gps_bounds: &GPSBounds) {
}
}
fn convert_polygon(input: PolygonType, name: String, map_name: String, gps_bounds: &GPSBounds) {
fn convert_polygon(
input: PolygonType,
name: String,
city_name: String,
map_name: String,
gps_bounds: &GPSBounds,
) {
if input.len() > 1 {
println!("{} has a polygon with an inner ring, skipping", name);
return;
@ -53,6 +60,7 @@ fn convert_polygon(input: PolygonType, name: String, map_name: String, gps_bound
}
}
NeighborhoodBuilder {
city_name,
map_name,
name,
points,

View File

@ -10,6 +10,8 @@ use std::io::{BufRead, BufReader};
pub fn extract_osm(
osm_path: &str,
maybe_clip_path: &Option<String>,
city_name: &str,
map_name: &str,
timer: &mut Timer,
) -> (
RawMap,
@ -35,9 +37,9 @@ pub fn extract_osm(
done(timer);
let mut map = if let Some(ref path) = maybe_clip_path {
read_osmosis_polygon(path)
read_osmosis_polygon(path, city_name, map_name)
} else {
let mut m = RawMap::blank(abstutil::basename(osm_path));
let mut m = RawMap::blank(city_name, map_name);
for node in doc.nodes.values() {
m.gps_bounds.update(LonLat::new(node.lon, node.lat));
}
@ -456,7 +458,7 @@ fn glue_to_boundary(result_pl: PolyLine, boundary: &Ring) -> Option<Polygon> {
Some(Polygon::new(&trimmed_pts))
}
fn read_osmosis_polygon(path: &str) -> RawMap {
fn read_osmosis_polygon(path: &str, city_name: &str, map_name: &str) -> RawMap {
let mut pts: Vec<LonLat> = Vec::new();
let mut gps_bounds = GPSBounds::new();
for (idx, maybe_line) in BufReader::new(File::open(path).unwrap())
@ -480,7 +482,7 @@ fn read_osmosis_polygon(path: &str) -> RawMap {
gps_bounds.update(pt);
}
let mut map = RawMap::blank(abstutil::basename(path));
let mut map = RawMap::blank(city_name, map_name);
map.boundary_polygon = Polygon::new(&gps_bounds.must_convert(&pts));
map.gps_bounds = gps_bounds;
map

View File

@ -1,122 +1,136 @@
68c20b1b71afbd5531aeb6c080cdd69d data/input/fixes/huge_seattle.json
88d1fd31af1c59ba4ebb2272504b321c data/input/fixes/23rd.json
4cda6f154fc64920765bebf4b72f1c8d data/input/fixes/montlake.json
d4a8e733045b28c0385fb81359d6df03 data/input/trips_2014.csv
e4546fa3a8778d73d4dbae5bf5e6072d data/input/osm/montlake.osm
b5f64e800ea1e70b2326792aee494e9a data/input/osm/huge_seattle.osm
a30b0f460a481598e494f16a9d07a822 data/input/osm/downtown_atx.osm
c2f29dfce01a727671b9c67772ee3ed5 data/input/osm/ballard.osm
7c8d72cf97072af34cee665006b1e9e6 data/input/osm/Austin.osm
f36e72469646c1cf25ceb42ae82b2a6f data/input/osm/23rd.osm
fb166029fc8006bd20dc959fbbbde3b6 data/input/osm/huge_austin.osm
79f7686dcb469a6262e13d5e61571303 data/input/osm/downtown.osm
9315a7df9e878865ff361ea89129970b data/input/osm/intl_district.osm
791b47c83ef94d65c709be027061d13c data/input/osm/caphill.osm
a04a70a76161c802c6488d5a843ea244 data/input/osm/lakeslice.osm
e2a3187ab5be2bf76369823853d86c14 data/input/osm/Seattle.osm
b0294210de30fee57a204f4c7852df9d data/input/neighborhoods/ballard/West Woodland.json
134c34c99e93e3fdef736e7b9a1a6d90 data/input/neighborhoods/ballard/Adams.json
0273adb18ead495ff542fb7c90b779cc data/input/neighborhoods/ballard/Phinney Ridge.json
13a49dbacf1e40c2a68e756632128b7f data/input/neighborhoods/ballard/Fremont.json
af08ef81c9ba3d693854f65180d6c42c data/input/neighborhoods/ballard/Lawton Park.json
07d2b3da4fe8e71328762bb3a4a26ba0 data/input/neighborhoods/intl_district/International District.json
721155dd7662b9aaaf68b222aa731560 data/input/neighborhoods/x1/Harrison - Denny-Blaine.json
2e9dbd878640b904307dcadc1fd7334f data/input/neighborhoods/x1/Madison Park.json
f2b26082d44df01339f30d1cc2eb4178 data/input/neighborhoods/x1/Portage Bay.json
197ecdfed33e300e6f64275a896b2905 data/input/neighborhoods/x1/Eastlake.json
33128005e7f6caaab5d321558965f125 data/input/neighborhoods/x1/Broadway.json
a5dca5dd4a4b78efb17e69c2d557ab1b data/input/neighborhoods/x1/Stevens.json
519cbc4a6c2038fab9df172f2db63085 data/input/neighborhoods/x1/Montlake.json
a6860296e9b842be9226fc9fe1fc3cad data/input/neighborhoods/23rd/Mann.json
ed7dc58cf6e4fc61afd64dd973770f10 data/input/neighborhoods/lakeslice/Leschi.json
f8c72b08495801165046fb91bc4b3138 data/input/neighborhoods/lakeslice/Harrison - Denny-Blaine.json
64e01cf5faf709552168bc4dc30ba4a6 data/input/neighborhoods/lakeslice/Mann.json
6d8a88b76bdc14690c959f349c30bbf9 data/input/neighborhoods/lakeslice/Madrona.json
6da5d27cf9e113afd004667be3381527 data/input/neighborhoods/downtown/Pike-Market.json
3d8e21ae459dd03b5c357d6a630b31d3 data/input/neighborhoods/downtown/First Hill.json
732fd9f536d91a81e378ffec5c663f0a data/input/neighborhoods/downtown/Central Business District.json
8ea8250a370423ec9520709b7459229c data/input/neighborhoods/downtown/Belltown.json
f2d7e0a90fae8d31711fd37fcd9718a5 data/input/neighborhoods/huge_seattle/West Woodland.json
f14cb63a866161af7a79009419f5fd21 data/input/neighborhoods/huge_seattle/Westlake.json
580bc3ea6c9b3cc815c38ec5181b0858 data/input/neighborhoods/huge_seattle/North College Park.json
8c273924c07f76ade9a5484b06abef5c data/input/neighborhoods/huge_seattle/Lower Queen Anne.json
39029a5d7bc2383b6a3f63739866082e data/input/neighborhoods/huge_seattle/Adams.json
e08466b80ae3f3d47b557ec102bd7547 data/input/neighborhoods/huge_seattle/Leschi.json
8fb32f54bf124a27218342d80a880b0b data/input/neighborhoods/huge_seattle/University District.json
f83718a053d5ac61352c6abfd352b914 data/input/neighborhoods/huge_seattle/Pike-Market.json
7cb58cc9f553e464c56eff802067c879 data/input/neighborhoods/huge_seattle/Harrison - Denny-Blaine.json
edd4fe2cc274ea4554c5855e79ed5ade data/input/neighborhoods/huge_seattle/Roosevelt.json
58055de4974d22203f770082722fe9fa data/input/neighborhoods/huge_seattle/Whittier Heights.json
2170f688ff57114a89921dc6740e4671 data/input/neighborhoods/huge_seattle/Laurelhurst.json
c3ac7309ef28ae17e946d40c6b490223 data/input/neighborhoods/huge_seattle/International District.json
875dd4425966161012f4bb3926137ea0 data/input/neighborhoods/huge_seattle/Maple Leaf.json
0383dc9dc26d379572d786c91445cab0 data/input/neighborhoods/huge_seattle/First Hill.json
78911c43d3dc60e7499a9d6453883010 data/input/neighborhoods/huge_seattle/Madison Park.json
af53747bf8d3fae916c889896810929b data/input/neighborhoods/huge_seattle/Portage Bay.json
d998627db6f711ada38e9a3bcf5dd04c data/input/neighborhoods/huge_seattle/Central Business District.json
0c3011246788f34e75d09b2fa2a31108 data/input/neighborhoods/huge_seattle/South Lake Union.json
7f9ae69b3593fc54b42a64fbc6e38717 data/input/neighborhoods/huge_seattle/Greenwood.json
e8178607910bb0e6a74c327132cd1af6 data/input/neighborhoods/huge_seattle/Eastlake.json
6807f0d6baf260b9cc5715be89e164e8 data/input/neighborhoods/huge_seattle/Sunset Hill.json
a16f5d5a71f43c80aad599c34f918036 data/input/neighborhoods/huge_seattle/Broadway.json
976097ef7c1bc239ece3745e0681ed68 data/input/neighborhoods/huge_seattle/Phinney Ridge.json
b8b42f5fef978e5158125e22ef715cd4 data/input/neighborhoods/huge_seattle/Ravenna.json
ad421fca3b9beaa49d688e9fb8e2c412 data/input/neighborhoods/huge_seattle/Fremont.json
503cd0ff9ef92ddf5798262470046578 data/input/neighborhoods/huge_seattle/Yesler Terrace.json
7090624f654057f1b5158f516a662ac4 data/input/neighborhoods/huge_seattle/Wedgwood.json
6961533182eb81d9a352a9954aacd085 data/input/neighborhoods/huge_seattle/Sand Point.json
a006e06a89f7d58fd25073171dff7873 data/input/neighborhoods/huge_seattle/Wallingford.json
130227b4eec5744d3f747699d0a71642 data/input/neighborhoods/huge_seattle/Interbay.json
3b78ed2725ca95c22fc4c3e72603bd4c data/input/neighborhoods/huge_seattle/West Queen Anne.json
0f6044807c0a27d0a37c6a57455164b9 data/input/neighborhoods/huge_seattle/Southeast Magnolia.json
d3b26af786b60a33a632a066aed34ad6 data/input/neighborhoods/huge_seattle/North Beach - Blue Ridge.json
ab6bbbac5ce8bf4ef643ce46382ad4c4 data/input/neighborhoods/huge_seattle/Windermere.json
4ba02a037455715f3c77ca7bfe668ee2 data/input/neighborhoods/huge_seattle/Stevens.json
b0162a73d9023a0fc10cb0c0e76403b1 data/input/neighborhoods/huge_seattle/East Queen Anne.json
762609d9a170ff0fcaf7671f06f8ce4e data/input/neighborhoods/huge_seattle/Belltown.json
47971bee1be78a305ecb442dd9ddf059 data/input/neighborhoods/huge_seattle/Loyal Heights.json
31ea4d515ff983e2625eb8d2cbf61930 data/input/neighborhoods/huge_seattle/Mann.json
22619b004634a46f6d6bf0efbdc5481c data/input/neighborhoods/huge_seattle/View Ridge.json
f14a6803a9b3874edc44e35e71f99ef9 data/input/neighborhoods/huge_seattle/Minor.json
194bcf33fdde0a73ca9f32b32d152dcc data/input/neighborhoods/huge_seattle/Madrona.json
39044e4cfbda0a390717f8e8de53f0d9 data/input/neighborhoods/huge_seattle/Lawton Park.json
7fba527f49fee2dd698f52149fec1b85 data/input/neighborhoods/huge_seattle/Montlake.json
f8f4d600347638cafb5688a096331572 data/input/neighborhoods/huge_seattle/Briarcliff.json
26c6998e49233361180262bcd8b58a2a data/input/neighborhoods/huge_seattle/North Queen Anne.json
57b13ac060424106da0e2a8aed2eaf6b data/input/neighborhoods/huge_seattle/Pioneer Square.json
0843ce2be4652f309c926cf635ce4df1 data/input/neighborhoods/huge_seattle/Crown Hill.json
d65838b354287f1605914ce74a188219 data/input/neighborhoods/huge_seattle/Green Lake.json
39b8142bea1595f9b094792cb4df510d data/input/neighborhoods/huge_seattle/Bryant.json
0ba8ab46da7c8601c9dc5b9fe5116f2b data/input/neighborhoods/caphill/Portage Bay.json
f479ca9324e63569b5c129170afbf5ac data/input/neighborhoods/caphill/Eastlake.json
d14c96851d6289b867e008432f54320d data/input/neighborhoods/caphill/Broadway.json
5475db4ee8aa2a1c610670efca8eb830 data/input/neighborhoods/caphill/Stevens.json
955835e85d15a2fb6c4a8586b8e5cb73 data/input/neighborhoods/caphill/Montlake.json
19e8073a9f6c807b4492681b2c7570de data/input/blockface.bin
db63d7d606e8702d12f9399e87e6a00f data/input/parcels_urbansim.txt
70c91146f4ea2c83f17f3d6b99f3b89d data/input/raw_maps/huge_seattle.bin
82bb6b459eb2a6b4f0daf277348f5e6c data/input/raw_maps/ballard.bin
93553e321c5efac4b700ab9c2569eacb data/input/raw_maps/downtown.bin
6f15b586cb9a610f95b815fd12442dd7 data/input/raw_maps/caphill.bin
534b0bbf56981aee23d83338365dde7a data/input/raw_maps/lakeslice.bin
1e264a737cd4c4eed887c057a7b4eccf data/input/raw_maps/huge_austin.bin
4ff7768c4ad52eeb2d02f425d8294847 data/input/raw_maps/downtown_atx.bin
01cee37af1e49b295448933a89de9192 data/input/raw_maps/montlake.bin
0452d8d5998d782474256a083c6d8be3 data/input/raw_maps/intl_district.bin
558c575a44a072909e3ee1d9a50386bb data/input/raw_maps/23rd.bin
2bc84e4d194d7cea6007ae3b93f3b11b data/input/neighborhoods.geojson
025fc890c650c22f9fc35271dfeb8019 data/input/popdat.bin
428bc2e92ea02089cedbb614ce1d8f25 data/input/polygons/caphill.poly
4f291bbe84ac32a98d7d100be79ddc4b data/input/polygons/huge_seattle.poly
6b221b5e68a38f16f34e46a208c7ca15 data/input/polygons/lakeslice.poly
418bcd5b335d12a1aa8ef556367e0bad data/input/polygons/montlake.poly
8c6570b3bad2a362e0e6f4bb6f4a8fda data/input/polygons/huge_austin.poly
502f3bf285833fc061099a52f2f70819 data/input/polygons/intl_district.poly
5d48031ff3b288ecb22bd2a96809a0ab data/input/polygons/ballard.poly
dc9a8a05f8f2e508af7a9841866f8cd3 data/input/polygons/downtown_atx.poly
0304847f270859fcfc19c8ca122ed793 data/input/polygons/23rd.poly
54f5f16e5ec925cb29b4d1405a89ef94 data/input/polygons/downtown.poly
58485a3bdff2aea9769fffd207e3cf30 data/input/offstreet_parking.bin
68c20b1b71afbd5531aeb6c080cdd69d data/input/seattle/fixes/huge_seattle.json
88d1fd31af1c59ba4ebb2272504b321c data/input/seattle/fixes/23rd.json
4cda6f154fc64920765bebf4b72f1c8d data/input/seattle/fixes/montlake.json
d4a8e733045b28c0385fb81359d6df03 data/input/seattle/trips_2014.csv
e4546fa3a8778d73d4dbae5bf5e6072d data/input/seattle/osm/montlake.osm
b5f64e800ea1e70b2326792aee494e9a data/input/seattle/osm/huge_seattle.osm
c2f29dfce01a727671b9c67772ee3ed5 data/input/seattle/osm/ballard.osm
f36e72469646c1cf25ceb42ae82b2a6f data/input/seattle/osm/23rd.osm
79f7686dcb469a6262e13d5e61571303 data/input/seattle/osm/downtown.osm
9315a7df9e878865ff361ea89129970b data/input/seattle/osm/intl_district.osm
791b47c83ef94d65c709be027061d13c data/input/seattle/osm/caphill.osm
a04a70a76161c802c6488d5a843ea244 data/input/seattle/osm/lakeslice.osm
e2a3187ab5be2bf76369823853d86c14 data/input/seattle/osm/Seattle.osm
46d8ebc909717b5ddfe921cf487f975d data/input/seattle/neighborhoods/ballard/West Woodland.json
ba915a6237156522eac2f380e978bb25 data/input/seattle/neighborhoods/ballard/Adams.json
ae6e3c5801460075cebe736e56d98b01 data/input/seattle/neighborhoods/ballard/Phinney Ridge.json
886cff1b9508af1917d76d746336c961 data/input/seattle/neighborhoods/ballard/Fremont.json
ae8a868fe3eac6c67340f174dc24866a data/input/seattle/neighborhoods/ballard/Lawton Park.json
1e2ff5d0083b0e5aab885d38be992ad7 data/input/seattle/neighborhoods/intl_district/International District.json
721155dd7662b9aaaf68b222aa731560 data/input/seattle/neighborhoods/x1/Harrison - Denny-Blaine.json
2e9dbd878640b904307dcadc1fd7334f data/input/seattle/neighborhoods/x1/Madison Park.json
f2b26082d44df01339f30d1cc2eb4178 data/input/seattle/neighborhoods/x1/Portage Bay.json
197ecdfed33e300e6f64275a896b2905 data/input/seattle/neighborhoods/x1/Eastlake.json
33128005e7f6caaab5d321558965f125 data/input/seattle/neighborhoods/x1/Broadway.json
a5dca5dd4a4b78efb17e69c2d557ab1b data/input/seattle/neighborhoods/x1/Stevens.json
519cbc4a6c2038fab9df172f2db63085 data/input/seattle/neighborhoods/x1/Montlake.json
ae65aaa3a0ddb7bb990972c9832369b6 data/input/seattle/neighborhoods/23rd/Mann.json
d9e0bc911a52aa15f51cb49956d2aef5 data/input/seattle/neighborhoods/lakeslice/Leschi.json
1ac65f96b8f4a2b2d365949032966402 data/input/seattle/neighborhoods/lakeslice/Harrison - Denny-Blaine.json
7b5a6df2a313b997e1ac575f6cec03d6 data/input/seattle/neighborhoods/lakeslice/Mann.json
eb073e33d652161805fd42c982856703 data/input/seattle/neighborhoods/lakeslice/Madrona.json
e62769afe799c43dbbe73e164e6bd620 data/input/seattle/neighborhoods/downtown/Pike-Market.json
d02cb65749922832091b18ad45a4400e data/input/seattle/neighborhoods/downtown/First Hill.json
64073270987303abf1532e6abaaa2676 data/input/seattle/neighborhoods/downtown/Central Business District.json
2374dd1b296f7bffa436e14ff2ddcd36 data/input/seattle/neighborhoods/downtown/Belltown.json
796f5d8eb1a5f1bfe85b2945239e14de data/input/seattle/neighborhoods/huge_seattle/West Woodland.json
8f586abbc7c18ee104493f7f83d88b20 data/input/seattle/neighborhoods/huge_seattle/Westlake.json
778beb76a0f0f2c4e5f71e56f6a37076 data/input/seattle/neighborhoods/huge_seattle/North College Park.json
21376d86306c45e82ddbbc4acd62a3ce data/input/seattle/neighborhoods/huge_seattle/Lower Queen Anne.json
90e78679efe05bb5c51c095bd56df8db data/input/seattle/neighborhoods/huge_seattle/Adams.json
7d2570e9728af1313c0af70b35ff7c12 data/input/seattle/neighborhoods/huge_seattle/Leschi.json
02e25d6d76d0a9b8823e8783d01d499b data/input/seattle/neighborhoods/huge_seattle/University District.json
4c9c0bbd2c4d30166cc82b6c9291de78 data/input/seattle/neighborhoods/huge_seattle/Pike-Market.json
2ff1b7b76f126ed69227923d40ecdaa3 data/input/seattle/neighborhoods/huge_seattle/Harrison - Denny-Blaine.json
a65a48ca68f15635fd86e7fdd06ddaea data/input/seattle/neighborhoods/huge_seattle/Roosevelt.json
57103a4893df8c1667674d8de47bee0b data/input/seattle/neighborhoods/huge_seattle/Whittier Heights.json
9cb7a0ef7a3bcdb634681e21d2f6fea3 data/input/seattle/neighborhoods/huge_seattle/Laurelhurst.json
cb93fd55d3b42979a96dc45e5571f5ac data/input/seattle/neighborhoods/huge_seattle/International District.json
9f04e6fa311b2274a42ee4b29f11d4e8 data/input/seattle/neighborhoods/huge_seattle/Maple Leaf.json
a8d1df39941171daa16195cc98692907 data/input/seattle/neighborhoods/huge_seattle/First Hill.json
b7fcb8b06ce4f571849fd33a277d21af data/input/seattle/neighborhoods/huge_seattle/Madison Park.json
c45186b872050db02e053afcf4a7424e data/input/seattle/neighborhoods/huge_seattle/Portage Bay.json
b4f6a4f24dab7eed34347069748ed6ce data/input/seattle/neighborhoods/huge_seattle/Central Business District.json
ffcca5e408c97cb81d1f739816809e01 data/input/seattle/neighborhoods/huge_seattle/South Lake Union.json
db4b1be3343681f5bcd8115181f95f08 data/input/seattle/neighborhoods/huge_seattle/Greenwood.json
6d50b3ae6f11de62b44e6109a435d002 data/input/seattle/neighborhoods/huge_seattle/Eastlake.json
b809cb0eb9a77a138c447d92d2a036ad data/input/seattle/neighborhoods/huge_seattle/Sunset Hill.json
1c27ea07ae9f046e79bdd79a0dbc4863 data/input/seattle/neighborhoods/huge_seattle/Broadway.json
a205318630171b21d3d8172c44a973d1 data/input/seattle/neighborhoods/huge_seattle/Phinney Ridge.json
02c097d984b9e039b7b9912f03ddf717 data/input/seattle/neighborhoods/huge_seattle/Ravenna.json
fc6dc3658c5d9cb01d778db3026731c6 data/input/seattle/neighborhoods/huge_seattle/Fremont.json
14b37651f6259ba8ed8f7dc04a93245b data/input/seattle/neighborhoods/huge_seattle/Yesler Terrace.json
a3b74ad210d5ae94c8fb8a23ffd7b521 data/input/seattle/neighborhoods/huge_seattle/Wedgwood.json
f60c9d7699b39ed6d99109ff0a4b7ee9 data/input/seattle/neighborhoods/huge_seattle/Sand Point.json
7957979d53d4a6364b9020a119c1f9e9 data/input/seattle/neighborhoods/huge_seattle/Wallingford.json
c642b472850a444e1d436a3dc8de5c57 data/input/seattle/neighborhoods/huge_seattle/Interbay.json
b19598d61c1301e4573edd927fb4ba38 data/input/seattle/neighborhoods/huge_seattle/West Queen Anne.json
331b23ca4b2d94d6e38026dfd7dfc386 data/input/seattle/neighborhoods/huge_seattle/Southeast Magnolia.json
b89543b001bc1e6f7ec5afda712a9532 data/input/seattle/neighborhoods/huge_seattle/North Beach - Blue Ridge.json
0f8511e1759b3150d77752aa9608ddd5 data/input/seattle/neighborhoods/huge_seattle/Windermere.json
c9fe0cec21b4506b9449f8e286707f62 data/input/seattle/neighborhoods/huge_seattle/Stevens.json
8f1b6913ee7ddee6c3ad6762077e1940 data/input/seattle/neighborhoods/huge_seattle/East Queen Anne.json
3f1e1d2473fcd9909ed48885156d8ad9 data/input/seattle/neighborhoods/huge_seattle/Belltown.json
7148acd286b453d20db96ad3a8461727 data/input/seattle/neighborhoods/huge_seattle/Loyal Heights.json
14c4caa74a3aab96b3270c9add7c8019 data/input/seattle/neighborhoods/huge_seattle/Mann.json
af28f6e4b3ef367fed0d828a47e5208d data/input/seattle/neighborhoods/huge_seattle/View Ridge.json
05ca8b996e144d45ae49961638e37135 data/input/seattle/neighborhoods/huge_seattle/Minor.json
4b0347aeed2ad2e3cf3b71a07efba3e0 data/input/seattle/neighborhoods/huge_seattle/Madrona.json
baa4ebb40bc293c6176a3239620e7183 data/input/seattle/neighborhoods/huge_seattle/Lawton Park.json
78b4d30d5bb4e7e8a40c7728124fd890 data/input/seattle/neighborhoods/huge_seattle/Montlake.json
271892c6453b6e0d512f948d9b7de62a data/input/seattle/neighborhoods/huge_seattle/Briarcliff.json
92d4c74df6478e29cdb0281ba4ff7894 data/input/seattle/neighborhoods/huge_seattle/North Queen Anne.json
9666b4689a2927797fe865becd6f61b7 data/input/seattle/neighborhoods/huge_seattle/Pioneer Square.json
18ae58793ddede2c087dbc7f9876266a data/input/seattle/neighborhoods/huge_seattle/Crown Hill.json
d729d8ef4f797d51dbb53096a4aac233 data/input/seattle/neighborhoods/huge_seattle/Green Lake.json
4be236f94749a0325f9696d0ed051e85 data/input/seattle/neighborhoods/huge_seattle/Bryant.json
1e608dafe6199b70929bb6bae84ead30 data/input/seattle/neighborhoods/caphill/Portage Bay.json
82c31490f1c0b5f7ab2e75766c8a9e04 data/input/seattle/neighborhoods/caphill/Eastlake.json
790ca481f2ea517acd63c97cc58b4d10 data/input/seattle/neighborhoods/caphill/Broadway.json
2b5fe53d1566708e1484181f026a77db data/input/seattle/neighborhoods/caphill/Stevens.json
96794d4b0d55abbacc48ff2df9941230 data/input/seattle/neighborhoods/caphill/Montlake.json
19e8073a9f6c807b4492681b2c7570de data/input/seattle/blockface.bin
db63d7d606e8702d12f9399e87e6a00f data/input/seattle/parcels_urbansim.txt
2bc84e4d194d7cea6007ae3b93f3b11b data/input/seattle/neighborhoods.geojson
025fc890c650c22f9fc35271dfeb8019 data/input/seattle/popdat.bin
428bc2e92ea02089cedbb614ce1d8f25 data/input/seattle/polygons/caphill.poly
4f291bbe84ac32a98d7d100be79ddc4b data/input/seattle/polygons/huge_seattle.poly
6b221b5e68a38f16f34e46a208c7ca15 data/input/seattle/polygons/lakeslice.poly
418bcd5b335d12a1aa8ef556367e0bad data/input/seattle/polygons/montlake.poly
502f3bf285833fc061099a52f2f70819 data/input/seattle/polygons/intl_district.poly
5d48031ff3b288ecb22bd2a96809a0ab data/input/seattle/polygons/ballard.poly
0304847f270859fcfc19c8ca122ed793 data/input/seattle/polygons/23rd.poly
54f5f16e5ec925cb29b4d1405a89ef94 data/input/seattle/polygons/downtown.poly
58485a3bdff2aea9769fffd207e3cf30 data/input/seattle/offstreet_parking.bin
129b460f56f5eb41cab3bfd70fb5fde9 data/input/seattle/sidewalks.bin
0db4e23e51f7680538b0bbbc72208e07 data/input/seattle/N47W122.hgt
51dbf7a263fe5f0ea24e43c3aad3fec2 data/input/seattle/google_transit/stop_times.txt
308c4e4ab385b7e8c1a1f75c4dc96e3f data/input/seattle/google_transit/routes.txt
9d3deb093076d7eaf748114829802292 data/input/seattle/google_transit/calendar_dates.txt
1800e4da804a8d9809d8b636742b9d00 data/input/seattle/google_transit/fare_rules.txt
9502d1a6e03a21c7e6987c036d5aea6f data/input/seattle/google_transit/block_trip.txt
b66cb4c0a24b2d038427aa6e1aa1954a data/input/seattle/google_transit/block.txt
7211c370ecf3d8839ea0eb6651ed18e9 data/input/seattle/google_transit/calendar.txt
33f4f1264b3c982f0d6922ce7fb45e73 data/input/seattle/google_transit/shapes.txt
8a4fbb3846249777afae319d64e6241e data/input/seattle/google_transit/trips.txt
ca5a7569e1af41e0046fe5e8865cf733 data/input/seattle/google_transit/fare_attributes.txt
8610cdc491d036eee88c9b7ae24d692d data/input/seattle/google_transit/stops.txt
75f564fcc06b1950b7b33acf9d61f696 data/input/seattle/google_transit/agency.txt
9902835baa19d6b2b3e64f87f24e50d8 data/input/raw_maps/huge_seattle.bin
7883d9cd9c5120d475d7880cc14b4e20 data/input/raw_maps/ballard.bin
f802aff8d8c1d5d8ec1caa295ccf8040 data/input/raw_maps/downtown.bin
f1a4f5663df3c6a488f1b0663ab8f61f data/input/raw_maps/caphill.bin
f0a8fff1790d96384482805d134c4ee5 data/input/raw_maps/lakeslice.bin
b50223a417508afb924252ae3ecd24ad data/input/raw_maps/huge_austin.bin
d4f6ece8ef35c594c794928d651c5916 data/input/raw_maps/downtown_atx.bin
c7a0ec6f43daff30af58cd223d9771b8 data/input/raw_maps/montlake.bin
27e559028ac7e2339ff7969ad6d5e37d data/input/raw_maps/intl_district.bin
22fbf319194f1ad011b53794640ef156 data/input/raw_maps/23rd.bin
a30b0f460a481598e494f16a9d07a822 data/input/austin/osm/downtown_atx.osm
7c8d72cf97072af34cee665006b1e9e6 data/input/austin/osm/Austin.osm
fb166029fc8006bd20dc959fbbbde3b6 data/input/austin/osm/huge_austin.osm
8c6570b3bad2a362e0e6f4bb6f4a8fda data/input/austin/polygons/huge_austin.poly
dc9a8a05f8f2e508af7a9841866f8cd3 data/input/austin/polygons/downtown_atx.poly
7dbf9830b6a37f6e58d3effc54363de7 data/input/screenshots/montlake/02x05_i124.png
244fe61defcf394590775582ef438f17 data/input/screenshots/montlake/01x06_i26.png
e6e912d845568358261fd74576b57f87 data/input/screenshots/montlake/01x01_i19.png
@ -136,20 +150,6 @@ ce30a66567ab09cb1c36d731c15cd5e1 data/input/screenshots/montlake/01x02_i20.png
9eb0005ac206fba788042e655cfbe300 data/input/screenshots/montlake/03x05_i2.png
d12a9d72fcbf32cb75d2820a78fa5e22 data/input/screenshots/montlake/02x06_i85.png
a7fec0718264a554de0fc282f9737ea0 data/input/screenshots/montlake/01x05_i40.png
129b460f56f5eb41cab3bfd70fb5fde9 data/input/sidewalks.bin
0db4e23e51f7680538b0bbbc72208e07 data/input/N47W122.hgt
51dbf7a263fe5f0ea24e43c3aad3fec2 data/input/google_transit/stop_times.txt
308c4e4ab385b7e8c1a1f75c4dc96e3f data/input/google_transit/routes.txt
9d3deb093076d7eaf748114829802292 data/input/google_transit/calendar_dates.txt
1800e4da804a8d9809d8b636742b9d00 data/input/google_transit/fare_rules.txt
9502d1a6e03a21c7e6987c036d5aea6f data/input/google_transit/block_trip.txt
b66cb4c0a24b2d038427aa6e1aa1954a data/input/google_transit/block.txt
7211c370ecf3d8839ea0eb6651ed18e9 data/input/google_transit/calendar.txt
33f4f1264b3c982f0d6922ce7fb45e73 data/input/google_transit/shapes.txt
8a4fbb3846249777afae319d64e6241e data/input/google_transit/trips.txt
ca5a7569e1af41e0046fe5e8865cf733 data/input/google_transit/fare_attributes.txt
8610cdc491d036eee88c9b7ae24d692d data/input/google_transit/stops.txt
75f564fcc06b1950b7b33acf9d61f696 data/input/google_transit/agency.txt
e4d10fa4a66453b7097d906e4616e26b data/system/assets/meters/car.svg
9d747979fdc362ac6df0af3c3bbffd15 data/system/assets/meters/bus.svg
f7facfb678770c416e5529b2b2d066e5 data/system/assets/meters/pedestrian.svg
@ -223,16 +223,16 @@ d02d0d103f7b00672a5f1145c5169d8c data/system/fonts/Overpass-Bold.ttf
2a13391023ce8787887331530cac35a7 data/system/fonts/BungeeInline-Regular.ttf
17a1468e62195d0688a6f3bd12da2e92 data/system/fonts/Overpass-SemiBold.ttf
259d4afad7edca07e727ef80f5bbce07 data/system/fonts/Bungee-Regular.ttf
42362e4328a20462a755ac10a5d97fa1 data/system/maps/huge_seattle.bin
949a22e70d06e03bdee666e5784cdf19 data/system/maps/ballard.bin
8b31c23a7f0b985894a39683159c7918 data/system/maps/downtown.bin
1727e93afe6d1ddc07b5f6ed008658be data/system/maps/caphill.bin
35e398d0dce3e4ade875c91245f88423 data/system/maps/lakeslice.bin
f258d23f81e16c5d884972853fcbb376 data/system/maps/huge_austin.bin
38ef21a636e63ce54ba319834191c8fd data/system/maps/downtown_atx.bin
f37497dbcca236b261b7205d8dd01aa4 data/system/maps/montlake.bin
6aec1579e6e6125c559212ee17c1d79f data/system/maps/intl_district.bin
608b5d2eaaa094ef6a0f1de2f97b28ac data/system/maps/23rd.bin
e4ef975bd5ca2a761f2af6aa79ddbfa7 data/system/maps/huge_seattle.bin
2ce839572159c8819b17ca87502fd063 data/system/maps/ballard.bin
20c561149888a0732a3c2d5ccad41f5f data/system/maps/downtown.bin
a088ac86bd2fbbde9d0be53535f44670 data/system/maps/caphill.bin
1851f79a44f0ccde301a3f16edfaa852 data/system/maps/lakeslice.bin
4961886805fc8a5576a37cffc6adc9be data/system/maps/huge_austin.bin
94d44bfd4c5e2431c7f8555943e70709 data/system/maps/downtown_atx.bin
29eca63f2c687160f78f7f8dbb85981f data/system/maps/montlake.bin
973a782a7d4dd1de4dc0cc7521ee9e1a data/system/maps/intl_district.bin
b8c50322ebcbd970c9eb40d7b177b477 data/system/maps/23rd.bin
cc45f42cb24cad1cfdbf5ed7a0cb86d4 data/system/synthetic_maps/signal_double.json
8b949cc34d9a27ace0bd8ecde55a9520 data/system/synthetic_maps/signal_single.json
1cd7be125e1d992613ed3a41e8b25b6a data/system/synthetic_maps/signal_fan_in.json

View File

@ -119,17 +119,17 @@ code. This is a nice, hefty starter project to understand how everything works.
For now, this is just an initial list of considerations -- I haven't designed or
implemented this yet.
Poking around the .osm extracts in `data/input/osm/`, you'll see a promising
relation with `route = light_rail`. The relation points to individual points
(nodes) as stops, and segments of the track (ways). These need to be represented
in the initial version of the map, `RawMap`, and the final version, `Map`.
Stations probably coincide with existing buildings, and tracks could probably be
modeled as a special type of road. To remember the order of stations and group
everything, there's already a notion of bus route from the `gtfs` crate that
probably works. The `convert_osm` crate is the place to extract this new data
from OSM. It might be worth thinking about how the light rail line gets clipped,
since most maps won't include all of the stations -- should those maps just
terminate trains at the stations, or should trains go to and from the map
Poking around the .osm extracts in `data/input/seattle/osm/`, you'll see a
promising relation with `route = light_rail`. The relation points to individual
points (nodes) as stops, and segments of the track (ways). These need to be
represented in the initial version of the map, `RawMap`, and the final version,
`Map`. Stations probably coincide with existing buildings, and tracks could
probably be modeled as a special type of road. To remember the order of stations
and group everything, there's already a notion of bus route from the `gtfs`
crate that probably works. The `convert_osm` crate is the place to extract this
new data from OSM. It might be worth thinking about how the light rail line gets
clipped, since most maps won't include all of the stations -- should those maps
just terminate trains at the stations, or should trains go to and from the map
border?
Then there are some rendering questions. How should special buildings that act

View File

@ -205,6 +205,7 @@ fn pick_neighborhood(map: &Map, mut wizard: WrappedWizard) -> Option<Neighborhoo
} else {
let name = wizard.input_string("Name the neighborhood")?;
Some(NeighborhoodBuilder {
city_name: map.get_city_name().to_string(),
name,
map_name: map.get_name().to_string(),
points: Vec::new(),
@ -220,7 +221,7 @@ fn load_neighborhood_builder(
wizard
.choose(query, || {
Choice::from(abstutil::load_all_objects(
abstutil::path_all_neighborhoods(&map.get_name()),
abstutil::path_all_neighborhoods(map.get_city_name(), map.get_name()),
))
})
.map(|(_, n)| n)

View File

@ -2,7 +2,7 @@ use crate::utils::{download, osmconvert, rm};
fn input() {
download(
"../data/input/osm/Austin.osm",
"../data/input/austin/osm/Austin.osm",
"https://download.bbbike.org/osm/bbbike/Austin/Austin.osm.gz",
);
}
@ -10,18 +10,21 @@ fn input() {
pub fn osm_to_raw(name: &str) {
input();
osmconvert(
"../data/input/osm/Austin.osm",
format!("../data/input/polygons/{}.poly", name),
format!("../data/input/osm/{}.osm", name),
"../data/input/austin/osm/Austin.osm",
format!("../data/input/austin/polygons/{}.poly", name),
format!("../data/input/austin/osm/{}.osm", name),
);
rm(format!("../data/input/neighborhoods/{}", name));
rm(format!("../data/system/maps/{}.bin", name));
println!("- Running convert_osm");
let output = format!("../data/input/raw_maps/{}.bin", name);
let map = convert_osm::convert(
convert_osm::Options {
osm: format!("../data/input/osm/{}.osm", name),
osm_input: format!("../data/input/austin/osm/{}.osm", name),
output: output.clone(),
city_name: "austin".to_string(),
name: name.to_string(),
parking_shapes: None,
public_offstreet_parking: None,
private_offstreet_parking: convert_osm::PrivateOffstreetParking::OnePerBldg,
@ -29,9 +32,8 @@ pub fn osm_to_raw(name: &str) {
gtfs: None,
neighborhoods: None,
elevation: None,
clip: Some(format!("../data/input/polygons/{}.poly", name)),
clip: Some(format!("../data/input/austin/polygons/{}.poly", name)),
drive_on_right: true,
output: output.clone(),
},
&mut abstutil::Timer::throwaway(),
);

View File

@ -30,7 +30,7 @@ fn main() {
// By default, use geometry fixes from map_editor.
use_fixes: !args.enabled("--nofixes"),
// Only process one map. If not specified, process all maps defined by clipping polygons in
// data/input/polygons/.
// data/input/$city/polygons/.
only_map: args.optional_free(),
};
args.done();
@ -46,7 +46,7 @@ fn main() {
vec![n]
} else {
println!("- Working on all {} maps", job.city);
abstutil::list_all_objects("../data/input/polygons".to_string())
abstutil::list_all_objects(format!("../data/input/{}/polygons", job.city))
};
for name in names {

View File

@ -2,65 +2,70 @@ use crate::utils::{download, osmconvert, rm};
fn input() {
download(
"../data/input/google_transit/",
"../data/input/seattle/google_transit/",
"https://metro.kingcounty.gov/GTFS/google_transit.zip",
);
// Like https://data.seattle.gov/dataset/Neighborhoods/2mbt-aqqx, but in GeoJSON, not SHP
download("../data/input/neighborhoods.geojson", "https://github.com/seattleio/seattle-boundaries-data/raw/master/data/neighborhoods.geojson");
download("../data/input/seattle/neighborhoods.geojson", "https://github.com/seattleio/seattle-boundaries-data/raw/master/data/neighborhoods.geojson");
download(
"../data/input/N47W122.hgt",
"../data/input/seattle/N47W122.hgt",
"https://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_01/N47W122.hgt.zip",
);
download(
"../data/input/osm/Seattle.osm",
"../data/input/seattle/osm/Seattle.osm",
"http://download.bbbike.org/osm/bbbike/Seattle/Seattle.osm.gz",
);
// Soundcast data comes from https://github.com/psrc/soundcast/releases
download(
"../data/input/parcels_urbansim.txt",
"../data/input/seattle/parcels_urbansim.txt",
"https://www.dropbox.com/s/t9oug9lwhdwfc04/psrc_2014.zip?dl=0",
);
// From http://data-seattlecitygis.opendata.arcgis.com/datasets/blockface
download(
"../data/input/blockface.bin",
"../data/input/seattle/blockface.bin",
"https://opendata.arcgis.com/datasets/a1458ad1abca41869b81f7c0db0cd777_0.kml",
);
// From https://data-seattlecitygis.opendata.arcgis.com/datasets/sidewalks
download(
"../data/input/sidewalks.bin",
"../data/input/seattle/sidewalks.bin",
"https://opendata.arcgis.com/datasets/ee6d0642d2a04e35892d0eab77d971d6_2.kml",
);
// From https://data.seattle.gov/Transportation/Public-Garages-or-Parking-Lots/xefx-khzm
download("../data/input/offstreet_parking.bin", "http://data-seattlecitygis.opendata.arcgis.com/datasets/8e52dfde6d5d45948f7a90654c8d50cd_0.kml");
download("../data/input/seattle/offstreet_parking.bin", "http://data-seattlecitygis.opendata.arcgis.com/datasets/8e52dfde6d5d45948f7a90654c8d50cd_0.kml");
}
pub fn osm_to_raw(name: &str) {
input();
osmconvert(
"../data/input/osm/Seattle.osm",
format!("../data/input/polygons/{}.poly", name),
format!("../data/input/osm/{}.osm", name),
"../data/input/seattle/osm/Seattle.osm",
format!("../data/input/seattle/polygons/{}.poly", name),
format!("../data/input/seattle/osm/{}.osm", name),
);
rm(format!("../data/input/neighborhoods/{}", name));
rm(format!("../data/input/seattle/neighborhoods/{}", name));
rm(format!("../data/system/maps/{}.bin", name));
println!("- Running convert_osm");
let output = format!("../data/input/raw_maps/{}.bin", name);
let map = convert_osm::convert(
convert_osm::Options {
osm: format!("../data/input/osm/{}.osm", name),
parking_shapes: Some("../data/input/blockface.bin".to_string()),
public_offstreet_parking: Some("../data/input/offstreet_parking.bin".to_string()),
osm_input: format!("../data/input/seattle/osm/{}.osm", name),
output: output.clone(),
city_name: "seattle".to_string(),
name: name.to_string(),
parking_shapes: Some("../data/input/seattle/blockface.bin".to_string()),
public_offstreet_parking: Some(
"../data/input/seattle/offstreet_parking.bin".to_string(),
),
private_offstreet_parking: convert_osm::PrivateOffstreetParking::OnePerBldg,
// TODO These're buggy.
sidewalks: None,
gtfs: Some("../data/input/google_transit".to_string()),
neighborhoods: Some("../data/input/neighborhoods.geojson".to_string()),
elevation: Some("../data/input/N47W122.hgt".to_string()),
clip: Some(format!("../data/input/polygons/{}.poly", name)),
gtfs: Some("../data/input/seattle/google_transit".to_string()),
neighborhoods: Some("../data/input/seattle/neighborhoods.geojson".to_string()),
elevation: Some("../data/input/seattle/N47W122.hgt".to_string()),
clip: Some(format!("../data/input/seattle/polygons/{}.poly", name)),
drive_on_right: true,
output: output.clone(),
},
&mut abstutil::Timer::throwaway(),
);

View File

@ -17,8 +17,8 @@ pub struct PopDat {
pub fn import_data() {
let mut timer = abstutil::Timer::new("creating popdat");
let (trips, parcels) = import_trips(
"../data/input/parcels_urbansim.txt",
"../data/input/trips_2014.csv",
"../data/input/seattle/parcels_urbansim.txt",
"../data/input/seattle/trips_2014.csv",
&mut timer,
)
.unwrap();

View File

@ -130,7 +130,7 @@ impl Model {
pub fn save_fixes(&mut self) {
abstutil::write_json(
abstutil::path_fixes(&self.map.name),
abstutil::path_fixes(&self.map.city, &self.map.name),
&self
.map
.generate_fixes(&mut Timer::new("calculate MapFixes")),

View File

@ -12,7 +12,6 @@ pub struct InitialMap {
pub roads: BTreeMap<OriginalRoad, Road>,
pub intersections: BTreeMap<OriginalIntersection, Intersection>,
pub name: String,
pub bounds: Bounds,
}
@ -70,11 +69,10 @@ pub struct Intersection {
}
impl InitialMap {
pub fn new(name: String, raw: &RawMap, bounds: &Bounds, timer: &mut Timer) -> InitialMap {
pub fn new(raw: &RawMap, bounds: &Bounds, timer: &mut Timer) -> InitialMap {
let mut m = InitialMap {
roads: BTreeMap::new(),
intersections: BTreeMap::new(),
name,
bounds: bounds.clone(),
};

View File

@ -45,6 +45,7 @@ pub struct Map {
pathfinder: Option<Pathfinder>,
pathfinder_dirty: bool,
city_name: String,
name: String,
edits: MapEdits,
}
@ -103,6 +104,7 @@ impl Map {
turn_lookup: Vec::new(),
pathfinder: None,
pathfinder_dirty: false,
city_name: "blank city".to_string(),
name: "blank".to_string(),
edits: MapEdits::new("blank"),
}
@ -112,7 +114,7 @@ impl Map {
timer.start("raw_map to InitialMap");
let gps_bounds = raw.gps_bounds.clone();
let bounds = gps_bounds.to_bounds();
let initial_map = make::initial::InitialMap::new(raw.name.clone(), &raw, &bounds, timer);
let initial_map = make::initial::InitialMap::new(&raw, &bounds, timer);
timer.stop("raw_map to InitialMap");
timer.start("InitialMap to half of Map");
@ -431,6 +433,10 @@ impl Map {
&self.bounds
}
pub fn get_city_name(&self) -> &String {
&self.city_name
}
pub fn get_name(&self) -> &String {
&self.name
}
@ -830,6 +836,7 @@ fn make_half_map(
turn_lookup: Vec::new(),
pathfinder: None,
pathfinder_dirty: false,
city_name: raw.city_name.clone(),
name: raw.name.clone(),
edits: MapEdits::new(&raw.name),
};

View File

@ -10,6 +10,7 @@ use std::io::{Error, Write};
// more compatible with slight changes to the bounding box of a map over time.
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct NeighborhoodBuilder {
pub city_name: String,
pub map_name: String,
pub name: String,
pub points: Vec<LonLat>,
@ -19,6 +20,7 @@ impl NeighborhoodBuilder {
pub fn finalize(&self, gps_bounds: &GPSBounds) -> Neighborhood {
assert!(self.points.len() >= 3);
Neighborhood {
city_name: self.city_name.clone(),
map_name: self.map_name.clone(),
name: self.name.clone(),
polygon: Polygon::new(
@ -36,14 +38,14 @@ impl NeighborhoodBuilder {
pub fn save(&self) {
abstutil::write_json(
abstutil::path_neighborhood(&self.map_name, &self.name),
abstutil::path_neighborhood(&self.city_name, &self.map_name, &self.name),
self,
);
}
// https://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format
pub fn save_as_osmosis(&self) -> Result<(), Error> {
let path = abstutil::path_polygon(&self.name);
let path = abstutil::path_polygon(&self.city_name, &self.name);
let mut f = File::create(&path)?;
writeln!(f, "{}", self.name)?;
@ -65,15 +67,20 @@ impl NeighborhoodBuilder {
#[derive(Clone, Debug)]
pub struct Neighborhood {
pub city_name: String,
pub map_name: String,
pub name: String,
pub polygon: Polygon,
}
impl Neighborhood {
pub fn load_all(map_name: &str, gps_bounds: &GPSBounds) -> Vec<(String, Neighborhood)> {
pub fn load_all(
city_name: &str,
map_name: &str,
gps_bounds: &GPSBounds,
) -> Vec<(String, Neighborhood)> {
abstutil::load_all_objects::<NeighborhoodBuilder>(abstutil::path_all_neighborhoods(
map_name,
city_name, map_name,
))
.into_iter()
.map(|(name, builder)| (name, builder.finalize(gps_bounds)))
@ -82,6 +89,7 @@ impl Neighborhood {
fn make_everywhere(map: &Map) -> Neighborhood {
Neighborhood {
city_name: map.get_city_name().to_string(),
map_name: map.get_name().to_string(),
name: "_everywhere_".to_string(),
polygon: map.get_bounds().get_rectangle(),
@ -97,7 +105,8 @@ pub struct FullNeighborhoodInfo {
impl FullNeighborhoodInfo {
pub fn load_all(map: &Map) -> HashMap<String, FullNeighborhoodInfo> {
let mut neighborhoods = Neighborhood::load_all(map.get_name(), map.get_gps_bounds());
let mut neighborhoods =
Neighborhood::load_all(map.get_city_name(), map.get_name(), map.get_gps_bounds());
neighborhoods.push((
"_everywhere_".to_string(),
Neighborhood::make_everywhere(map),

View File

@ -9,6 +9,7 @@ use std::fmt;
#[derive(Debug, Serialize, Deserialize)]
pub struct RawMap {
pub city_name: String,
pub name: String,
#[serde(
serialize_with = "serialize_btreemap",
@ -87,9 +88,10 @@ impl fmt::Display for OriginalBuilding {
}
impl RawMap {
pub fn blank(name: String) -> RawMap {
pub fn blank(city_name: &str, name: &str) -> RawMap {
RawMap {
name,
city_name: city_name.to_string(),
name: name.to_string(),
roads: BTreeMap::new(),
intersections: BTreeMap::new(),
buildings: BTreeMap::new(),
@ -103,17 +105,24 @@ impl RawMap {
}
pub fn apply_all_fixes(&mut self, timer: &mut Timer) {
// TODO Seattle-specific right now
if self.city_name != "seattle" {
return;
}
if self.name == "huge_seattle" {
let master_fixes: MapFixes =
abstutil::maybe_read_json(abstutil::path_fixes("huge_seattle"), timer)
.unwrap_or_else(|_| MapFixes::new(self.gps_bounds.clone()));
let master_fixes: MapFixes = abstutil::maybe_read_json(
abstutil::path_fixes(&self.city_name, "huge_seattle"),
timer,
)
.unwrap_or_else(|_| MapFixes::new(self.gps_bounds.clone()));
self.apply_fixes("huge_seattle", &master_fixes, timer);
} else {
let mut master_fixes: MapFixes =
abstutil::read_json(abstutil::path_fixes("huge_seattle"), timer);
abstutil::read_json(abstutil::path_fixes(&self.city_name, "huge_seattle"), timer);
master_fixes.remap_pts(&self.gps_bounds);
let local_fixes: MapFixes =
abstutil::maybe_read_json(abstutil::path_fixes(&self.name), timer)
abstutil::maybe_read_json(abstutil::path_fixes(&self.city_name, &self.name), timer)
.unwrap_or_else(|_| MapFixes::new(self.gps_bounds.clone()));
self.apply_fixes("huge_seattle", &master_fixes, timer);
self.apply_fixes(&self.name.clone(), &local_fixes, timer);
@ -189,6 +198,8 @@ impl RawMap {
// TODO Ignores buildings right now.
pub fn generate_fixes(&self, timer: &mut Timer) -> MapFixes {
// TODO Need to generalize this a bit
assert_eq!(self.city_name, "seattle");
let orig: RawMap = abstutil::read_binary(abstutil::path_raw_map(&self.name), timer);
let mut fixes = MapFixes::new(self.gps_bounds.clone());
@ -229,7 +240,7 @@ impl RawMap {
if self.name != "huge_seattle" {
// Filter out things that we just inherited from the master fixes.
let mut master_fixes: MapFixes =
abstutil::read_json(abstutil::path_fixes("huge_seattle"), timer);
abstutil::read_json(abstutil::path_fixes(&self.city_name, "huge_seattle"), timer);
master_fixes.remap_pts(&self.gps_bounds);
fixes.delete_roads = fixes