trim down map file size a bit by not storing building OSM tags, which

weren't useful anyway. 873MB for all maps down to 786MB. huge_seattle
343MB to 305MB
This commit is contained in:
Dustin Carlino 2020-05-08 14:46:36 -07:00
parent 819aa179d7
commit 7f867fda70
12 changed files with 83 additions and 90 deletions

View File

@ -184,20 +184,20 @@ 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,da422e2afc2d4dc34f76b2f5169ece5d,https://www.dropbox.com/s/wjl45codk6rqfg4/23rd.bin.zip?dl=0
data/system/maps/ballard.bin,beec943241420863a0dab9c863583742,https://www.dropbox.com/s/u4rvz50she3yrk0/ballard.bin.zip?dl=0
data/system/maps/barranquilla.bin,51fb8787696fd41f2785233b8899992c,https://www.dropbox.com/s/iuvggdfr16u6luw/barranquilla.bin.zip?dl=0
data/system/maps/caphill.bin,6af5cc38a440d3a3c6524620c0dfd5e7,https://www.dropbox.com/s/bh20pn3wxygetw8/caphill.bin.zip?dl=0
data/system/maps/downtown.bin,daa99edacf932ceab88f0c9fa2363cf5,https://www.dropbox.com/s/4do5cg4vc17lafo/downtown.bin.zip?dl=0
data/system/maps/downtown_atx.bin,adaaeb4616d8aba97c67e8e168b69d23,https://www.dropbox.com/s/5avnbkd4oxby2hs/downtown_atx.bin.zip?dl=0
data/system/maps/downtown_la.bin,126479cf28da991b47e75a3300ea1680,https://www.dropbox.com/s/gkcl982cj6kxvrz/downtown_la.bin.zip?dl=0
data/system/maps/huge_austin.bin,8d0dedf397eccd8cfc57bf9a0bc9af65,https://www.dropbox.com/s/khy0m6v9yt0gjnt/huge_austin.bin.zip?dl=0
data/system/maps/huge_seattle.bin,59be81b79ac7e2ab4f29e7c84c546726,https://www.dropbox.com/s/btvr3qajshnivhb/huge_seattle.bin.zip?dl=0
data/system/maps/intl_district.bin,d7bdb9bbca282f7b7673ea78393d0d6b,https://www.dropbox.com/s/fohppni52ekc5l3/intl_district.bin.zip?dl=0
data/system/maps/lakeslice.bin,4c9d47923d26b02b380206249075e096,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,00a226a29ee2e1870b744adc6b8b2bcb,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
data/system/maps/mt_baker.bin,b35d608a9515670ebad02b22c3b64700,https://www.dropbox.com/s/cetje663p04cbgp/mt_baker.bin.zip?dl=0
data/system/maps/west_seattle.bin,266255bffd72d6de9651c97aca8d6167,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
data/system/maps/23rd.bin,67a35681f945a7abd3411ad7e4825ada,https://www.dropbox.com/s/wjl45codk6rqfg4/23rd.bin.zip?dl=0
data/system/maps/ballard.bin,32fd83a02db400bd28aab2bbbad18a26,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,b141ef6441b981344aefaadc9f4711aa,https://www.dropbox.com/s/bh20pn3wxygetw8/caphill.bin.zip?dl=0
data/system/maps/downtown.bin,9f941fd4274399b64b70aeba7177bcbc,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,542ffe0298b5d617d66e7642b281cda1,https://www.dropbox.com/s/btvr3qajshnivhb/huge_seattle.bin.zip?dl=0
data/system/maps/intl_district.bin,f5229127d597341bedb96241be4c86c6,https://www.dropbox.com/s/fohppni52ekc5l3/intl_district.bin.zip?dl=0
data/system/maps/lakeslice.bin,3cab6b2fddccaac1ba89f3fa29ee75d5,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,88e837106b5945d71ca9a32b78cf1f3d,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
data/system/maps/mt_baker.bin,89140764ff22b43a8ac104639fac7094,https://www.dropbox.com/s/cetje663p04cbgp/mt_baker.bin.zip?dl=0
data/system/maps/west_seattle.bin,7bac885a032f532974d78aa675f89589,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,11075622a8321ded0c8ba0188b70c964,https://www.dropbox.com/s/1c1sohvy50263wg/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/car vs bike contention.bin,8a9728d341898471e9ace488a0409143,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,a5826964d4ee3780641f237d660c639f,https://www.dropbox.com/s/1aq7n9ow8tfqb5d/weekday.bin.zip?dl=0

View File

@ -138,7 +138,7 @@ impl CommonState {
osd.append(Line(" is "));
}
let bldg = map.get_b(b);
osd.append(Line(bldg.get_name(map)).fg(name_color));
osd.append(Line(&bldg.address).fg(name_color));
}
ID::Turn(t) => {
// Only selectable in dev mode anyway

View File

@ -344,18 +344,6 @@ fn search_osm(wiz: &mut Wizard, ctx: &mut EventCtx, app: &mut App) -> Option<Tra
batch.push(color, r.get_thick_polygon(map).unwrap());
}
}
for b in map.all_buildings() {
if b.osm_tags
.iter()
.any(|(k, v)| format!("{} = {}", k, v).contains(&filter))
|| b.amenities
.iter()
.any(|(n, a)| n.contains(&filter) || a.contains(&filter))
{
num_matches += 1;
batch.push(color, b.polygon.clone());
}
}
for a in map.all_areas() {
if a.osm_tags
.iter()

View File

@ -13,9 +13,9 @@ pub fn info(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BuildingID
let mut kv = Vec::new();
kv.push(("Address", b.just_address(&app.primary.map)));
if let Some(name) = b.just_name() {
kv.push(("Name", name.to_string()));
kv.push(("Address", b.address.clone()));
if let Some(ref name) = b.name {
kv.push(("Name", name.clone()));
}
if let Some(ref p) = b.parking {
@ -86,23 +86,6 @@ pub fn info(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BuildingID
rows
}
pub fn debug(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BuildingID) -> Vec<Widget> {
let mut rows = header(ctx, app, details, id, Tab::BldgDebug(id));
let b = app.primary.map.get_b(id);
rows.extend(make_table(
ctx,
vec![(
"Dist along sidewalk",
b.front_path.sidewalk.dist_along().to_string(),
)],
));
rows.push("Raw OpenStreetMap data".draw_text(ctx));
rows.extend(make_table(ctx, b.osm_tags.clone().into_iter().collect()));
rows
}
pub fn people(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BuildingID) -> Vec<Widget> {
let mut rows = header(ctx, app, details, id, Tab::BldgPeople(id));
@ -181,11 +164,7 @@ fn header(
ctx,
&mut details.hyperlinks,
tab,
vec![
("Info", Tab::BldgInfo(id)),
("Debug", Tab::BldgDebug(id)),
("People", Tab::BldgPeople(id)),
],
vec![("Info", Tab::BldgInfo(id)), ("People", Tab::BldgPeople(id))],
));
draw_occupants(details, app, id, None);

View File

@ -59,7 +59,6 @@ pub enum Tab {
ParkedCar(CarID),
BldgInfo(BuildingID),
BldgDebug(BuildingID),
BldgPeople(BuildingID),
Crowd(Vec<PedestrianID>),
@ -133,7 +132,7 @@ impl Tab {
ParkingSpot::Onstreet(_, _) => Some(ID::Car(c)),
ParkingSpot::Offstreet(b, _) => Some(ID::Building(b)),
},
Tab::BldgInfo(b) | Tab::BldgDebug(b) | Tab::BldgPeople(b) => Some(ID::Building(b)),
Tab::BldgInfo(b) | Tab::BldgPeople(b) => Some(ID::Building(b)),
Tab::Crowd(members) => Some(ID::PedCrowd(members)),
Tab::Area(a) => Some(ID::Area(a)),
Tab::ExtraShape(es) => Some(ID::ExtraShape(es)),
@ -203,7 +202,6 @@ impl InfoPanel {
true,
),
Tab::BldgInfo(b) => (building::info(ctx, app, &mut details, b), true),
Tab::BldgDebug(b) => (building::debug(ctx, app, &mut details, b), false),
Tab::BldgPeople(b) => (building::people(ctx, app, &mut details, b), false),
Tab::Crowd(ref members) => (person::crowd(ctx, app, &mut details, members), true),
Tab::Area(a) => (debug::area(ctx, app, &mut details, a), true),

View File

@ -381,11 +381,7 @@ pub fn parked_car(
ctx.canvas
.center_on_map_pt(app.primary.map.get_b(b).polygon.center());
rows.push(
format!(
"Parked inside {}",
app.primary.map.get_b(b).get_name(&app.primary.map)
)
.draw_text(ctx),
format!("Parked inside {}", app.primary.map.get_b(b).address).draw_text(ctx),
);
}
}
@ -499,7 +495,7 @@ fn current_status(ctx: &EventCtx, person: &Person, map: &Map) -> Widget {
(match person.state {
PersonState::Inside(b) => {
// TODO hyperlink
format!("Currently inside {}", map.get_b(b).just_address(map)).draw_text(ctx)
format!("Currently inside {}", map.get_b(b).address).draw_text(ctx)
}
PersonState::Trip(_) => unreachable!(),
PersonState::OffMap => "Currently outside the map boundaries".draw_text(ctx),

View File

@ -606,7 +606,7 @@ fn endpoint(endpt: &TripEndpoint, map: &Map) -> (ID, Pt2D, String) {
match endpt {
TripEndpoint::Bldg(b) => {
let bldg = map.get_b(*b);
(ID::Building(*b), bldg.label_center, bldg.just_address(map))
(ID::Building(*b), bldg.label_center, bldg.address.clone())
}
TripEndpoint::Border(i, _) => {
let i = map.get_i(*i);

View File

@ -56,7 +56,7 @@ impl DrawBuilding {
// TODO Uh oh, this is lots of work upfront. Disable by default. :(
let label = if false {
bldg.osm_tags.get("addr:housenumber").map(|num| {
bldg.house_number().map(|num| {
let mut lbl = GeomBatch::new();
lbl.add_transformed(
Text::from(Line(num.to_string()).fg(Color::BLACK)).render_to_batch(prerender),

View File

@ -1,7 +1,7 @@
use crate::{osm, LaneID, Map, Position};
use crate::{LaneID, Position};
use geom::{Line, PolyLine, Polygon, Pt2D};
use serde_derive::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeSet;
use std::fmt;
// TODO reconsider pub usize. maybe outside world shouldnt know.
@ -38,7 +38,8 @@ pub struct OffstreetParking {
pub struct Building {
pub id: BuildingID,
pub polygon: Polygon,
pub osm_tags: BTreeMap<String, String>,
pub address: String,
pub name: Option<String>,
pub osm_way_id: i64,
// Where a text label should be centered to have the best chances of being contained within the
// polygon.
@ -57,28 +58,12 @@ impl Building {
self.front_path.sidewalk.lane()
}
pub fn just_address(&self, map: &Map) -> String {
match (
self.osm_tags.get("addr:housenumber"),
self.osm_tags.get("addr:street"),
) {
(Some(num), Some(st)) => format!("{} {}", num, st),
(None, Some(st)) => format!("??? {}", st),
_ => format!("??? {}", map.get_parent(self.sidewalk()).get_name()),
}
}
pub fn just_name(&self) -> Option<&String> {
self.osm_tags.get(osm::NAME)
}
// TODO I think this one only has one caller
pub fn get_name(&self, map: &Map) -> String {
let address = self.just_address(map);
if let Some(name) = self.just_name() {
format!("{} (at {})", name, address)
pub fn house_number(&self) -> Option<String> {
let num = self.address.split(" ").next().unwrap();
if num != "???" {
Some(num.to_string())
} else {
address
None
}
}
}

View File

@ -1,6 +1,6 @@
use crate::make::sidewalk_finder::find_sidewalk_points;
use crate::raw::{OriginalBuilding, RawBuilding};
use crate::{Building, BuildingID, FrontPath, LaneType, Map, OffstreetParking};
use crate::{osm, Building, BuildingID, FrontPath, LaneID, LaneType, Map, OffstreetParking};
use abstutil::Timer;
use geom::{Distance, HashablePt2D, Line, PolyLine, Polygon};
use std::collections::{BTreeMap, HashSet};
@ -51,7 +51,8 @@ pub fn make_all_buildings(
let mut bldg = Building {
id,
polygon: b.polygon.clone(),
osm_tags: b.osm_tags.clone(),
address: get_address(&b.osm_tags, sidewalk_pos.lane(), map),
name: b.osm_tags.get(osm::NAME).cloned(),
osm_way_id: orig_id.osm_way_id,
front_path: FrontPath {
sidewalk: *sidewalk_pos,
@ -123,3 +124,11 @@ fn trim_path(poly: &Polygon, path: Line) -> Line {
// Just give up
path
}
fn get_address(tags: &BTreeMap<String, String>, sidewalk: LaneID, map: &Map) -> String {
match (tags.get("addr:housenumber"), tags.get("addr:street")) {
(Some(num), Some(st)) => format!("{} {}", num, st),
(None, Some(st)) => format!("??? {}", st),
_ => format!("??? {}", map.get_parent(sidewalk).get_name()),
}
}

View File

@ -56,7 +56,44 @@ impl Map {
if path.starts_with(&abstutil::path_all_maps()) {
match abstutil::maybe_read_binary(path.clone(), timer) {
Ok(map) => {
crate::pathfind::uber_turns::find(&map);
let map: Map = map;
if false {
use abstutil::{prettyprint_usize, serialized_size_bytes};
println!(
"- roads: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.roads))
);
println!(
"- lanes: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.lanes))
);
println!(
"- intersections: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.intersections))
);
println!(
"- turns: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.turns))
);
println!(
"- buildings: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.buildings))
);
println!(
"- areas: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.areas))
);
println!(
"- pathfinder: {} bytes",
prettyprint_usize(serialized_size_bytes(&map.pathfinder))
);
}
if false {
crate::pathfind::uber_turns::find(&map);
}
return map;
}
Err(err) => {

View File

@ -206,6 +206,7 @@ impl Manifest {
|| map == "intl_district"
|| map == "lakeslice"
|| map == "montlake"
|| map == "mt_baker"
}
"huge_seattle" => map == "huge_seattle" || map == "west_seattle",
"austin" => map == "downtown_atx" || map == "huge_austin",