mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
Organize raw maps by city. With this, data/input/ is totally namespaced by city! Nothing prevents us from having a map named "downtown" in multiple cities now. #326
This commit is contained in:
parent
3d84defb71
commit
e15efa9002
3
.gitignore
vendored
3
.gitignore
vendored
@ -20,14 +20,13 @@ data/input/seattle/popdat.bin
|
|||||||
data/input/seattle/trips_2014.csv
|
data/input/seattle/trips_2014.csv
|
||||||
|
|
||||||
data/input/*/osm
|
data/input/*/osm
|
||||||
|
data/input/*/raw_maps
|
||||||
data/input/*/footways.bin
|
data/input/*/footways.bin
|
||||||
data/input/*/service_roads.bin
|
data/input/*/service_roads.bin
|
||||||
data/input/*/*_separate_cycleways.bin
|
data/input/*/*_separate_cycleways.bin
|
||||||
data/input/*/*_snapped_cycleways.bin
|
data/input/*/*_snapped_cycleways.bin
|
||||||
data/input/*/screenshots/*.zip
|
data/input/*/screenshots/*.zip
|
||||||
|
|
||||||
data/input/raw_maps
|
|
||||||
|
|
||||||
data/player
|
data/player
|
||||||
|
|
||||||
data/system/berlin
|
data/system/berlin
|
||||||
|
@ -195,8 +195,5 @@ pub fn path_popdat() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn path_raw_map(name: &MapName) -> String {
|
pub fn path_raw_map(name: &MapName) -> String {
|
||||||
path(format!("input/raw_maps/{}.bin", name.map))
|
path(format!("input/{}/raw_maps/{}.bin", name.city, name.map))
|
||||||
}
|
|
||||||
pub fn path_all_raw_maps() -> String {
|
|
||||||
path("input/raw_maps")
|
|
||||||
}
|
}
|
||||||
|
@ -67,18 +67,16 @@ use it as well.
|
|||||||
required by osmconvert.
|
required by osmconvert.
|
||||||
|
|
||||||
5. Create a new module in `importer/src/` for your city, copying
|
5. Create a new module in `importer/src/` for your city, copying
|
||||||
`importer/src/krakow.rs` as a guide. Edit that file in the obvious way. The
|
`importer/src/tel_aviv.rs` as a guide. Edit that file in the obvious way. The
|
||||||
main thing you'll need is a .osm or .osm.pbf file to download that contains
|
main thing you'll need is a .osm or .osm.pbf file to download that contains
|
||||||
your city. The clipping polygon will be applied to that.
|
your city. The clipping polygon will be applied to that.
|
||||||
|
|
||||||
6. Update `importer/src/main.rs` to reference your new module, following
|
6. Update `importer/src/main.rs` to reference your new module, following
|
||||||
`krakow` as an example.
|
`tel_aviv` as an example.
|
||||||
|
|
||||||
7. Update `map_belongs_to_city` in `updater/src/main.rs`
|
7. Run it: `./import.sh --city=your_city --raw --map`
|
||||||
|
|
||||||
8. Run it: `./import.sh --city=your_city --raw --map`
|
8. Update `.gitignore`, following `krakow` as an example.
|
||||||
|
|
||||||
9. Update `.gitignore`, following `krakow` as an example.
|
|
||||||
|
|
||||||
Send a PR with your changes! I'll generate everything and make it work with
|
Send a PR with your changes! I'll generate everything and make it work with
|
||||||
`updater`, so most people don't have to build everything from scratch.
|
`updater`, so most people don't have to build everything from scratch.
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
"checksum": "1bfc2044f1f5f40acdcdded1a644ad22",
|
"checksum": "1bfc2044f1f5f40acdcdded1a644ad22",
|
||||||
"size_bytes": 3054511
|
"size_bytes": 3054511
|
||||||
},
|
},
|
||||||
|
"data/input/berlin/raw_maps/berlin_center.bin": {
|
||||||
|
"checksum": "0045c35aada8114ba1c2cf0113708b2f",
|
||||||
|
"size_bytes": 9955976
|
||||||
|
},
|
||||||
"data/input/berlin/service_roads.bin": {
|
"data/input/berlin/service_roads.bin": {
|
||||||
"checksum": "be06e4b4136771f8e03a2ba7a5f9b8cd",
|
"checksum": "be06e4b4136771f8e03a2ba7a5f9b8cd",
|
||||||
"size_bytes": 445108
|
"size_bytes": 445108
|
||||||
@ -40,6 +44,10 @@
|
|||||||
"checksum": "9505917bbacc478177e36605e89b6d77",
|
"checksum": "9505917bbacc478177e36605e89b6d77",
|
||||||
"size_bytes": 117776270
|
"size_bytes": 117776270
|
||||||
},
|
},
|
||||||
|
"data/input/krakow/raw_maps/krakow_center.bin": {
|
||||||
|
"checksum": "d355436d13a89b6c6462a5aa4eb6720b",
|
||||||
|
"size_bytes": 14988445
|
||||||
|
},
|
||||||
"data/input/krakow/screenshots/krakow_center.zip": {
|
"data/input/krakow/screenshots/krakow_center.zip": {
|
||||||
"checksum": "c176076e6f60f03741ca44b0bfdf8545",
|
"checksum": "c176076e6f60f03741ca44b0bfdf8545",
|
||||||
"size_bytes": 14238180
|
"size_bytes": 14238180
|
||||||
@ -60,6 +68,10 @@
|
|||||||
"checksum": "0de99323ac548f889860f597704b2910",
|
"checksum": "0de99323ac548f889860f597704b2910",
|
||||||
"size_bytes": 33826429
|
"size_bytes": 33826429
|
||||||
},
|
},
|
||||||
|
"data/input/leeds/raw_maps/leeds_center.bin": {
|
||||||
|
"checksum": "38ec311a319b9ccca42c09172d2a8e59",
|
||||||
|
"size_bytes": 41794121
|
||||||
|
},
|
||||||
"data/input/leeds/service_roads.bin": {
|
"data/input/leeds/service_roads.bin": {
|
||||||
"checksum": "8588e5f3dda5d53903da869026ba1773",
|
"checksum": "8588e5f3dda5d53903da869026ba1773",
|
||||||
"size_bytes": 1376915
|
"size_bytes": 1376915
|
||||||
@ -76,6 +88,10 @@
|
|||||||
"checksum": "b86babace41d69a9e5b8be2310a725ae",
|
"checksum": "b86babace41d69a9e5b8be2310a725ae",
|
||||||
"size_bytes": 18059372
|
"size_bytes": 18059372
|
||||||
},
|
},
|
||||||
|
"data/input/london/raw_maps/southbank.bin": {
|
||||||
|
"checksum": "a6e3939121a21b99518f481865ef7ee0",
|
||||||
|
"size_bytes": 3317757
|
||||||
|
},
|
||||||
"data/input/london/screenshots/southbank.zip": {
|
"data/input/london/screenshots/southbank.zip": {
|
||||||
"checksum": "6a8b17f4f8abf68a3e7248bffc59a455",
|
"checksum": "6a8b17f4f8abf68a3e7248bffc59a455",
|
||||||
"size_bytes": 3936498
|
"size_bytes": 3936498
|
||||||
@ -84,62 +100,6 @@
|
|||||||
"checksum": "4f651a450d9d6b73618db015c34a03ad",
|
"checksum": "4f651a450d9d6b73618db015c34a03ad",
|
||||||
"size_bytes": 99666
|
"size_bytes": 99666
|
||||||
},
|
},
|
||||||
"data/input/raw_maps/ballard.bin": {
|
|
||||||
"checksum": "9321228f47483f7a14b2747e5ea84885",
|
|
||||||
"size_bytes": 21648115
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/berlin_center.bin": {
|
|
||||||
"checksum": "0045c35aada8114ba1c2cf0113708b2f",
|
|
||||||
"size_bytes": 9955976
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/downtown.bin": {
|
|
||||||
"checksum": "a01147203819f1b6f4ea893af4300c44",
|
|
||||||
"size_bytes": 7774126
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/huge_seattle.bin": {
|
|
||||||
"checksum": "77a10eb129d0d5ce61d79192bd55b996",
|
|
||||||
"size_bytes": 123426278
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/krakow_center.bin": {
|
|
||||||
"checksum": "d355436d13a89b6c6462a5aa4eb6720b",
|
|
||||||
"size_bytes": 14988445
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/lakeslice.bin": {
|
|
||||||
"checksum": "5362657bbcdac16ac22aadf58f2a769c",
|
|
||||||
"size_bytes": 9984817
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/leeds_center.bin": {
|
|
||||||
"checksum": "38ec311a319b9ccca42c09172d2a8e59",
|
|
||||||
"size_bytes": 41794121
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/montlake.bin": {
|
|
||||||
"checksum": "60776c41875cad8f79354dff8c4d3d47",
|
|
||||||
"size_bytes": 1883008
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/south_seattle.bin": {
|
|
||||||
"checksum": "e29c6adc12d97b5b2b8beb643271dcfd",
|
|
||||||
"size_bytes": 23677722
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/southbank.bin": {
|
|
||||||
"checksum": "a6e3939121a21b99518f481865ef7ee0",
|
|
||||||
"size_bytes": 3317757
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/tel_aviv.bin": {
|
|
||||||
"checksum": "b6faf60108d82d7308cc15e7edd26f30",
|
|
||||||
"size_bytes": 12342170
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/udistrict.bin": {
|
|
||||||
"checksum": "8dca7ce30cb5e6fa6417f8c2ce737fe2",
|
|
||||||
"size_bytes": 4393153
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/west_seattle.bin": {
|
|
||||||
"checksum": "4ed2b3505bd9ce9ca8158c174b8925e7",
|
|
||||||
"size_bytes": 25821468
|
|
||||||
},
|
|
||||||
"data/input/raw_maps/xian.bin": {
|
|
||||||
"checksum": "944535618cda403d0613ed485ef18072",
|
|
||||||
"size_bytes": 12038513
|
|
||||||
},
|
|
||||||
"data/input/seattle/N47W122.hgt": {
|
"data/input/seattle/N47W122.hgt": {
|
||||||
"checksum": "0db4e23e51f7680538b0bbbc72208e07",
|
"checksum": "0db4e23e51f7680538b0bbbc72208e07",
|
||||||
"size_bytes": 25934402
|
"size_bytes": 25934402
|
||||||
@ -260,6 +220,38 @@
|
|||||||
"checksum": "592592ec7bd0dadc7b09ee96a4d086a7",
|
"checksum": "592592ec7bd0dadc7b09ee96a4d086a7",
|
||||||
"size_bytes": 430666022
|
"size_bytes": 430666022
|
||||||
},
|
},
|
||||||
|
"data/input/seattle/raw_maps/ballard.bin": {
|
||||||
|
"checksum": "9321228f47483f7a14b2747e5ea84885",
|
||||||
|
"size_bytes": 21648115
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/downtown.bin": {
|
||||||
|
"checksum": "a01147203819f1b6f4ea893af4300c44",
|
||||||
|
"size_bytes": 7774126
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/huge_seattle.bin": {
|
||||||
|
"checksum": "77a10eb129d0d5ce61d79192bd55b996",
|
||||||
|
"size_bytes": 123426278
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/lakeslice.bin": {
|
||||||
|
"checksum": "5362657bbcdac16ac22aadf58f2a769c",
|
||||||
|
"size_bytes": 9984817
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/montlake.bin": {
|
||||||
|
"checksum": "60776c41875cad8f79354dff8c4d3d47",
|
||||||
|
"size_bytes": 1883008
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/south_seattle.bin": {
|
||||||
|
"checksum": "e29c6adc12d97b5b2b8beb643271dcfd",
|
||||||
|
"size_bytes": 23677722
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/udistrict.bin": {
|
||||||
|
"checksum": "8dca7ce30cb5e6fa6417f8c2ce737fe2",
|
||||||
|
"size_bytes": 4393153
|
||||||
|
},
|
||||||
|
"data/input/seattle/raw_maps/west_seattle.bin": {
|
||||||
|
"checksum": "4ed2b3505bd9ce9ca8158c174b8925e7",
|
||||||
|
"size_bytes": 25821468
|
||||||
|
},
|
||||||
"data/input/seattle/screenshots/downtown.zip": {
|
"data/input/seattle/screenshots/downtown.zip": {
|
||||||
"checksum": "4552a34fffb0c47b121f532d882964e8",
|
"checksum": "4552a34fffb0c47b121f532d882964e8",
|
||||||
"size_bytes": 14841175
|
"size_bytes": 14841175
|
||||||
@ -296,6 +288,10 @@
|
|||||||
"checksum": "eeb7f3813a33f754eceed13766a3c236",
|
"checksum": "eeb7f3813a33f754eceed13766a3c236",
|
||||||
"size_bytes": 43912053
|
"size_bytes": 43912053
|
||||||
},
|
},
|
||||||
|
"data/input/tel_aviv/raw_maps/tel_aviv.bin": {
|
||||||
|
"checksum": "b6faf60108d82d7308cc15e7edd26f30",
|
||||||
|
"size_bytes": 12342170
|
||||||
|
},
|
||||||
"data/input/tel_aviv/service_roads.bin": {
|
"data/input/tel_aviv/service_roads.bin": {
|
||||||
"checksum": "216407d6f112683e81973fbb11af6403",
|
"checksum": "216407d6f112683e81973fbb11af6403",
|
||||||
"size_bytes": 208181
|
"size_bytes": 208181
|
||||||
@ -312,6 +308,10 @@
|
|||||||
"checksum": "4084c665ad947bb40173a43cb33fdec8",
|
"checksum": "4084c665ad947bb40173a43cb33fdec8",
|
||||||
"size_bytes": 26198743
|
"size_bytes": 26198743
|
||||||
},
|
},
|
||||||
|
"data/input/xian/raw_maps/xian.bin": {
|
||||||
|
"checksum": "944535618cda403d0613ed485ef18072",
|
||||||
|
"size_bytes": 12038513
|
||||||
|
},
|
||||||
"data/input/xian/service_roads.bin": {
|
"data/input/xian/service_roads.bin": {
|
||||||
"checksum": "c9a1a296817cfbd6c64dbe0d3389c40a",
|
"checksum": "c9a1a296817cfbd6c64dbe0d3389c40a",
|
||||||
"size_bytes": 249765
|
"size_bytes": 249765
|
||||||
|
@ -103,9 +103,7 @@ impl SimFlags {
|
|||||||
scenario.instantiate(&mut sim, &map, &mut rng, timer);
|
scenario.instantiate(&mut sim, &map, &mut rng, timer);
|
||||||
|
|
||||||
(map, sim, rng)
|
(map, sim, rng)
|
||||||
} else if self.load.starts_with(&abstutil::path_all_raw_maps())
|
} else if self.load.contains("/raw_maps/") || self.load.contains("/maps/") {
|
||||||
|| self.load.contains("/maps/")
|
|
||||||
{
|
|
||||||
timer.note(format!("Loading map {}", self.load));
|
timer.note(format!("Loading map {}", self.load));
|
||||||
|
|
||||||
let map = Map::new(self.load.clone(), timer);
|
let map = Map::new(self.load.clone(), timer);
|
||||||
|
@ -201,29 +201,6 @@ fn generate_manifest() -> Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn filter_manifest(mut manifest: Manifest, cities: Cities) -> Manifest {
|
fn filter_manifest(mut manifest: Manifest, cities: Cities) -> Manifest {
|
||||||
// TODO Temporary hack until directories are organized better
|
|
||||||
fn map_belongs_to_city(map: &str, city: &str) -> bool {
|
|
||||||
match city {
|
|
||||||
"seattle" => {
|
|
||||||
map == "ballard"
|
|
||||||
|| map == "downtown"
|
|
||||||
|| map == "lakeslice"
|
|
||||||
|| map == "montlake"
|
|
||||||
|| map == "south_seattle"
|
|
||||||
|| map == "udistrict"
|
|
||||||
|| map == "west_seattle"
|
|
||||||
}
|
|
||||||
"huge_seattle" => map == "huge_seattle",
|
|
||||||
"krakow" => map == "krakow_center",
|
|
||||||
"leeds" => map == "leeds_center",
|
|
||||||
"berlin" => map == "berlin_center",
|
|
||||||
"xian" => map == "xian",
|
|
||||||
"tel_aviv" => map == "tel_aviv",
|
|
||||||
"london" => map == "southbank",
|
|
||||||
_ => panic!("Unknown city {}. Check your data/config", city),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut remove = Vec::new();
|
let mut remove = Vec::new();
|
||||||
for path in manifest.entries.keys() {
|
for path in manifest.entries.keys() {
|
||||||
// TODO Some hardcoded weird exceptions
|
// TODO Some hardcoded weird exceptions
|
||||||
@ -235,21 +212,7 @@ fn filter_manifest(mut manifest: Manifest, cities: Cities) -> Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let parts = path.split("/").collect::<Vec<_>>();
|
let parts = path.split("/").collect::<Vec<_>>();
|
||||||
if parts[1] == "input" {
|
if parts[1] == "input" || parts[1] == "system" {
|
||||||
if parts[2] == "raw_maps" {
|
|
||||||
let map = parts[3].trim_end_matches(".bin");
|
|
||||||
if cities
|
|
||||||
.input
|
|
||||||
.iter()
|
|
||||||
.any(|city| map_belongs_to_city(map, city))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if cities.input.contains(&parts[2].to_string()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else if parts[1] == "system" {
|
|
||||||
if cities.input.contains(&parts[2].to_string()) {
|
if cities.input.contains(&parts[2].to_string()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user