mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
also scrape amenities from buildings themselves. make an 'other'
category
This commit is contained in:
parent
26d12e5d75
commit
dd99936fa0
@ -53,7 +53,7 @@ pub fn extract_osm(
|
||||
let mut roads: Vec<(i64, RawRoad)> = Vec::new();
|
||||
let mut traffic_signals: HashSet<HashablePt2D> = HashSet::new();
|
||||
let mut osm_node_ids = HashMap::new();
|
||||
let mut amenities = Vec::new();
|
||||
let mut node_amenities = Vec::new();
|
||||
|
||||
timer.start_iter("processing OSM nodes", doc.nodes.len());
|
||||
for node in doc.nodes.values() {
|
||||
@ -66,7 +66,7 @@ pub fn extract_osm(
|
||||
traffic_signals.insert(pt.to_hashable());
|
||||
}
|
||||
if let Some(amenity) = tags.get("amenity") {
|
||||
amenities.push((
|
||||
node_amenities.push((
|
||||
pt,
|
||||
tags.get("name")
|
||||
.cloned()
|
||||
@ -75,7 +75,7 @@ pub fn extract_osm(
|
||||
));
|
||||
}
|
||||
if let Some(shop) = tags.get("shop") {
|
||||
amenities.push((
|
||||
node_amenities.push((
|
||||
pt,
|
||||
tags.get("name")
|
||||
.cloned()
|
||||
@ -165,6 +165,24 @@ pub fn extract_osm(
|
||||
if deduped.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut amenities = BTreeSet::new();
|
||||
if let Some(amenity) = tags.get("amenity") {
|
||||
amenities.insert((
|
||||
tags.get("name")
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "unnamed".to_string()),
|
||||
amenity.clone(),
|
||||
));
|
||||
}
|
||||
if let Some(shop) = tags.get("shop") {
|
||||
amenities.insert((
|
||||
tags.get("name")
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "unnamed".to_string()),
|
||||
shop.clone(),
|
||||
));
|
||||
}
|
||||
map.buildings.insert(
|
||||
OriginalBuilding { osm_way_id: way.id },
|
||||
RawBuilding {
|
||||
@ -172,7 +190,7 @@ pub fn extract_osm(
|
||||
osm_tags: tags,
|
||||
public_garage_name: None,
|
||||
num_parking_spots: 0,
|
||||
amenities: BTreeSet::new(),
|
||||
amenities,
|
||||
},
|
||||
);
|
||||
} else if let Some(at) = get_area_type(&tags) {
|
||||
@ -304,7 +322,7 @@ pub fn extract_osm(
|
||||
osm_node_ids,
|
||||
simple_turn_restrictions,
|
||||
complicated_turn_restrictions,
|
||||
amenities,
|
||||
node_amenities,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,19 @@
|
||||
data/input/austin/osm/Austin.osm,7c8d72cf97072af34cee665006b1e9e6,https://www.dropbox.com/s/4f3lu8ii5d2lf4c/Austin.osm.zip?dl=0
|
||||
data/input/austin/osm/downtown_atx.osm,a30b0f460a481598e494f16a9d07a822,https://www.dropbox.com/s/8qodpqdn1pedzva/downtown_atx.osm.zip?dl=0
|
||||
data/input/austin/osm/huge_austin.osm,fb166029fc8006bd20dc959fbbbde3b6,https://www.dropbox.com/s/4bbsfpsg48dctje/huge_austin.osm.zip?dl=0
|
||||
data/input/barranquilla/osm/barranquilla.osm,ff0f301a84d21f20c87ee7fa3ae3518f,https://www.dropbox.com/s/ag8owpwnegkf2z8/barranquilla.osm.zip?dl=0
|
||||
data/input/barranquilla/osm/colombia.osm.pbf,31c7abfcc1ec4625e6e4fbee9e89bfd3,https://www.dropbox.com/s/tq9c8jws9nngtrf/colombia.osm.pbf.zip?dl=0
|
||||
data/input/los_angeles/osm/downtown_la.osm,9b2c4729d3031553a477bb2e1134a6bf,https://www.dropbox.com/s/235jahht1xyulkx/downtown_la.osm.zip?dl=0
|
||||
data/input/los_angeles/osm/socal.osm.pbf,1dd1b7d3a6d38829a8266b0b6ea60b85,https://www.dropbox.com/s/gdd7lth4fmy0fby/socal.osm.pbf.zip?dl=0
|
||||
data/input/raw_maps/23rd.bin,4a4c621472b1e8c06eda4a021d70a1d5,https://www.dropbox.com/s/9g5589k9swdln9y/23rd.bin.zip?dl=0
|
||||
data/input/raw_maps/ballard.bin,341bd813caef48f497bc4d358e56ccff,https://www.dropbox.com/s/wus0ufcnjyvcsuy/ballard.bin.zip?dl=0
|
||||
data/input/raw_maps/barranquilla.bin,ebbefc90883a56cc3090c294a245bf22,https://www.dropbox.com/s/5z890kpowgeftk4/barranquilla.bin.zip?dl=0
|
||||
data/input/raw_maps/caphill.bin,7d158155e6c4019074898ed5c9ef7008,https://www.dropbox.com/s/vybo4owf8pzuita/caphill.bin.zip?dl=0
|
||||
data/input/raw_maps/downtown.bin,f4243cc8a01909e36161d4a8be751350,https://www.dropbox.com/s/ntqzttf25037fty/downtown.bin.zip?dl=0
|
||||
data/input/raw_maps/23rd.bin,4f109454d435aee75c3bd61ff3a926f2,https://www.dropbox.com/s/9g5589k9swdln9y/23rd.bin.zip?dl=0
|
||||
data/input/raw_maps/ballard.bin,9b77a14ac950740438cf89dae958c04c,https://www.dropbox.com/s/wus0ufcnjyvcsuy/ballard.bin.zip?dl=0
|
||||
data/input/raw_maps/caphill.bin,8b78c51ed309851c201e3516490ce473,https://www.dropbox.com/s/vybo4owf8pzuita/caphill.bin.zip?dl=0
|
||||
data/input/raw_maps/downtown.bin,be1aab62332c6724094ff0d132b5f457,https://www.dropbox.com/s/ntqzttf25037fty/downtown.bin.zip?dl=0
|
||||
data/input/raw_maps/downtown_atx.bin,b8bf1101d55440ccdaf6b4755a5d5701,https://www.dropbox.com/s/0cs55y1jcmm2alk/downtown_atx.bin.zip?dl=0
|
||||
data/input/raw_maps/downtown_la.bin,b6cd5f18c2e942413b0833476e5b4c85,https://www.dropbox.com/s/ca7eoxem5t9y99g/downtown_la.bin.zip?dl=0
|
||||
data/input/raw_maps/huge_austin.bin,5dbd9efb15a39432b28dc6fe9003cea4,https://www.dropbox.com/s/we0765ym7dlcsl1/huge_austin.bin.zip?dl=0
|
||||
data/input/raw_maps/huge_seattle.bin,e39e6eefe4083ce79dbbdf3106449563,https://www.dropbox.com/s/jcssts861uaovva/huge_seattle.bin.zip?dl=0
|
||||
data/input/raw_maps/intl_district.bin,ce36b26cf45ce9a7c22558419748b7d1,https://www.dropbox.com/s/yopzq58r9t4y93v/intl_district.bin.zip?dl=0
|
||||
data/input/raw_maps/lakeslice.bin,570fe85b960831366e30edb469088659,https://www.dropbox.com/s/4nmdtw0mgqe7tyg/lakeslice.bin.zip?dl=0
|
||||
data/input/raw_maps/montlake.bin,1b12e2d59960d26e9666103e441c29e8,https://www.dropbox.com/s/qk8rhwr6vdm79vz/montlake.bin.zip?dl=0
|
||||
data/input/raw_maps/mt_baker.bin,a56542c96d997cbcc282ff6f9d406343,https://www.dropbox.com/s/nr18iu83lrcyg8e/mt_baker.bin.zip?dl=0
|
||||
data/input/raw_maps/udistrict.bin,905af63f872c92a901c13bffcdf1f6e9,https://www.dropbox.com/s/o1gtavxtw8n3bhy/udistrict.bin.zip?dl=0
|
||||
data/input/raw_maps/west_seattle.bin,c048e6dc7a01fb75d42e7b7eee330d15,https://www.dropbox.com/s/112ym2cwg643c9n/west_seattle.bin.zip?dl=0
|
||||
data/input/raw_maps/huge_seattle.bin,cf49ae84f831d3f82f0290ed680129e7,https://www.dropbox.com/s/jcssts861uaovva/huge_seattle.bin.zip?dl=0
|
||||
data/input/raw_maps/intl_district.bin,d3d1117a7441c99d6c36293ba6df2d63,https://www.dropbox.com/s/yopzq58r9t4y93v/intl_district.bin.zip?dl=0
|
||||
data/input/raw_maps/lakeslice.bin,49b6cc97a227f1d88bd9e55effb96313,https://www.dropbox.com/s/4nmdtw0mgqe7tyg/lakeslice.bin.zip?dl=0
|
||||
data/input/raw_maps/montlake.bin,46d31da3068c344c8fefe9e0e064917c,https://www.dropbox.com/s/qk8rhwr6vdm79vz/montlake.bin.zip?dl=0
|
||||
data/input/raw_maps/mt_baker.bin,b49dddb1e7b90685638e54a9a1d08b58,https://www.dropbox.com/s/nr18iu83lrcyg8e/mt_baker.bin.zip?dl=0
|
||||
data/input/raw_maps/udistrict.bin,e01a5a7aaa51bfb1a1df9f9ddb52bf7e,https://www.dropbox.com/s/o1gtavxtw8n3bhy/udistrict.bin.zip?dl=0
|
||||
data/input/raw_maps/west_seattle.bin,728aa17fdf42feca04b09cd37addb5ca,https://www.dropbox.com/s/112ym2cwg643c9n/west_seattle.bin.zip?dl=0
|
||||
data/input/screenshots/lakeslice/01x01_i325.gif,40b1e76bb29e46823fa52186c891578b,https://www.dropbox.com/s/uiodmxawv8sheb1/01x01_i325.gif.zip?dl=0
|
||||
data/input/screenshots/lakeslice/01x02_i163.gif,bbe0f33acd8fa1cf8fe5028bea8cc9a2,https://www.dropbox.com/s/6zebcdhbeirab49/01x02_i163.gif.zip?dl=0
|
||||
data/input/screenshots/lakeslice/01x03_i1.gif,7f29ff99e19905709bc3e94123c7959f,https://www.dropbox.com/s/qn65mm834k8w1jr/01x03_i1.gif.zip?dl=0
|
||||
@ -180,21 +174,19 @@ data/input/seattle/parcels_urbansim.txt,db63d7d606e8702d12f9399e87e6a00f,https:/
|
||||
data/input/seattle/popdat.bin,793dd4075de7a4cf5ea8005cd68a06c8,https://www.dropbox.com/s/wrpji7e14rdwszs/popdat.bin.zip?dl=0
|
||||
data/input/seattle/sidewalks.bin,129b460f56f5eb41cab3bfd70fb5fde9,https://www.dropbox.com/s/ma9bmisijc7v7xa/sidewalks.bin.zip?dl=0
|
||||
data/input/seattle/trips_2014.csv,d4a8e733045b28c0385fb81359d6df03,https://www.dropbox.com/s/5ppravwmk6bf20d/trips_2014.csv.zip?dl=0
|
||||
data/system/maps/23rd.bin,251841f60d0e01cf1bee7c64e4ecf6c1,https://www.dropbox.com/s/wjl45codk6rqfg4/23rd.bin.zip?dl=0
|
||||
data/system/maps/ballard.bin,5dc492b430d70fb39b6ef8a42f0fd397,https://www.dropbox.com/s/u4rvz50she3yrk0/ballard.bin.zip?dl=0
|
||||
data/system/maps/barranquilla.bin,853bc8f1cc79b170c8e7569d1ccf1c3c,https://www.dropbox.com/s/iuvggdfr16u6luw/barranquilla.bin.zip?dl=0
|
||||
data/system/maps/caphill.bin,90117362c69f3a5d5d639db3e1fc14d8,https://www.dropbox.com/s/bh20pn3wxygetw8/caphill.bin.zip?dl=0
|
||||
data/system/maps/downtown.bin,ea1a3200db32b80c46614b26b15939bb,https://www.dropbox.com/s/4do5cg4vc17lafo/downtown.bin.zip?dl=0
|
||||
data/system/maps/23rd.bin,01cee5bea815bd0dd0dd0946c9867d8a,https://www.dropbox.com/s/wjl45codk6rqfg4/23rd.bin.zip?dl=0
|
||||
data/system/maps/ballard.bin,45089d1e07a12a3fb6577b84cc5677d5,https://www.dropbox.com/s/u4rvz50she3yrk0/ballard.bin.zip?dl=0
|
||||
data/system/maps/caphill.bin,de226d32ab6802b82be00ee198f33c45,https://www.dropbox.com/s/bh20pn3wxygetw8/caphill.bin.zip?dl=0
|
||||
data/system/maps/downtown.bin,c05f7e094649cad7e515ec5e234724d2,https://www.dropbox.com/s/4do5cg4vc17lafo/downtown.bin.zip?dl=0
|
||||
data/system/maps/downtown_atx.bin,b2d634b8aa1244261d3a5e3a6e8b8ab7,https://www.dropbox.com/s/5avnbkd4oxby2hs/downtown_atx.bin.zip?dl=0
|
||||
data/system/maps/downtown_la.bin,7511c31e495e9bce35fef18cc3fcb521,https://www.dropbox.com/s/gkcl982cj6kxvrz/downtown_la.bin.zip?dl=0
|
||||
data/system/maps/huge_austin.bin,1993956d19e43b1d27d8417435820f23,https://www.dropbox.com/s/khy0m6v9yt0gjnt/huge_austin.bin.zip?dl=0
|
||||
data/system/maps/huge_seattle.bin,1a5360b11f0cf844945e6503e7dabe81,https://www.dropbox.com/s/btvr3qajshnivhb/huge_seattle.bin.zip?dl=0
|
||||
data/system/maps/intl_district.bin,4a84a700249f7274a04d5c38061306f5,https://www.dropbox.com/s/fohppni52ekc5l3/intl_district.bin.zip?dl=0
|
||||
data/system/maps/lakeslice.bin,87f11a891c0a48b5e8201f3661155cf9,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
|
||||
data/system/maps/montlake.bin,3a8a42b02dc88231e68f2ba7199df164,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
|
||||
data/system/maps/mt_baker.bin,9e4e00b3e88166573788d49b6f50f2ce,https://www.dropbox.com/s/cetje663p04cbgp/mt_baker.bin.zip?dl=0
|
||||
data/system/maps/udistrict.bin,4e85b0a246d0331128e883337c4ea19a,https://www.dropbox.com/s/zqt2je8fadssz5j/udistrict.bin.zip?dl=0
|
||||
data/system/maps/west_seattle.bin,0288d1bcedf47b853a6e1b62d854f138,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
|
||||
data/system/maps/huge_seattle.bin,c9bd63ea077029b9859be8134b33fb2d,https://www.dropbox.com/s/btvr3qajshnivhb/huge_seattle.bin.zip?dl=0
|
||||
data/system/maps/intl_district.bin,f39a80415443427d2ece630f5bf1422b,https://www.dropbox.com/s/fohppni52ekc5l3/intl_district.bin.zip?dl=0
|
||||
data/system/maps/lakeslice.bin,35bac3dd581771ce41dc97738d8fe899,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
|
||||
data/system/maps/montlake.bin,d55cd6d8234699ad39eeb5663997d395,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
|
||||
data/system/maps/mt_baker.bin,1ac79948ee825ae100c9a74a8892d930,https://www.dropbox.com/s/cetje663p04cbgp/mt_baker.bin.zip?dl=0
|
||||
data/system/maps/udistrict.bin,f4f25d8321556e4f0c6c32d7efaba5b3,https://www.dropbox.com/s/zqt2je8fadssz5j/udistrict.bin.zip?dl=0
|
||||
data/system/maps/west_seattle.bin,e7535351458d9e127d985a979804b700,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
|
||||
data/system/prebaked_results/lakeslice/weekday.bin,0d8f50736c01d57ffbc42f568ea8bfd5,https://www.dropbox.com/s/1c1sohvy50263wg/weekday.bin.zip?dl=0
|
||||
data/system/prebaked_results/montlake/car vs bike contention.bin,951f6473d850f807a3466214d38178b7,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
|
||||
data/system/prebaked_results/montlake/weekday.bin,c7aff8de37cd9d3bec5a0ea8dbd42aa3,https://www.dropbox.com/s/1aq7n9ow8tfqb5d/weekday.bin.zip?dl=0
|
||||
|
@ -20,6 +20,9 @@ void main() {
|
||||
discard;
|
||||
}
|
||||
} else {
|
||||
// https://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
//float gray = dot(pass_style.rgb, vec3(0.299, 0.587, 0.114));
|
||||
//f_color = vec4(vec3(gray), pass_style.a);
|
||||
f_color = pass_style;
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ void main() {
|
||||
discard;
|
||||
}
|
||||
} else {
|
||||
// https://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
//float gray = dot(pass_style.rgb, vec3(0.299, 0.587, 0.114));
|
||||
//f_color = vec4(vec3(gray), pass_style.a);
|
||||
f_color = pass_style;
|
||||
}
|
||||
}
|
||||
|
@ -182,10 +182,12 @@ pub fn amenities(ctx: &mut EventCtx, app: &App) -> Layers {
|
||||
("media", Color::PINK),
|
||||
("childcare", Color::ORANGE),
|
||||
("shopping", Color::WHITE),
|
||||
("other", Color::hex("#96322F")),
|
||||
],
|
||||
);
|
||||
|
||||
for b in app.primary.map.all_buildings() {
|
||||
let mut other = false;
|
||||
for (_, a) in &b.amenities {
|
||||
if let Some(t) = amenity_type(a) {
|
||||
colorer.add_b(
|
||||
@ -205,9 +207,13 @@ pub fn amenities(ctx: &mut EventCtx, app: &App) -> Layers {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
other = true;
|
||||
println!("{}", a);
|
||||
}
|
||||
}
|
||||
if other {
|
||||
colorer.add_b(b.id, Color::hex("#96322F"));
|
||||
}
|
||||
}
|
||||
|
||||
Layers::Amenities(colorer.build_both(ctx, app))
|
||||
|
@ -77,12 +77,15 @@ fn main() {
|
||||
}
|
||||
|
||||
if job.raw_to_map {
|
||||
let name = name.clone();
|
||||
let handle = thread::spawn(move || {
|
||||
utils::raw_to_map(&name);
|
||||
});
|
||||
handles.push(handle);
|
||||
// TODO Bug: if regenerating map and scenario at the same time, this doesn't work.
|
||||
if job.scenario {
|
||||
utils::raw_to_map(&name);
|
||||
} else {
|
||||
let name = name.clone();
|
||||
handles.push(thread::spawn(move || {
|
||||
utils::raw_to_map(&name);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if job.scenario {
|
||||
|
Loading…
Reference in New Issue
Block a user