Import Tripoli for WeCode Libya, also adding an Arabic font

This commit is contained in:
Dustin Carlino 2021-03-23 06:51:47 -07:00
parent 4a704e3172
commit 162f09a887
10 changed files with 93 additions and 22 deletions

1
.gitignore vendored
View File

@ -53,6 +53,7 @@ data/system/gb/wichelstowe
data/system/gb/wixams
data/system/gb/wynyard
data/system/il/tel_aviv
data/system/ly/tripoli
data/system/pl/krakow
data/system/pl/warsaw
data/system/tw/taipei

View File

@ -1015,6 +1015,21 @@
"uncompressed_size_bytes": 14474825,
"compressed_size_bytes": 3022125
},
"data/input/ly/tripoli/osm/center.osm": {
"checksum": "e9b2289791e891153e957d8100eb40c4",
"uncompressed_size_bytes": 5799463,
"compressed_size_bytes": 695828
},
"data/input/ly/tripoli/osm/libya-latest.osm.pbf": {
"checksum": "e037faeadc44d8ad7423e5363d55a5a5",
"uncompressed_size_bytes": 30351959,
"compressed_size_bytes": 30303259
},
"data/input/ly/tripoli/raw_maps/center.bin": {
"checksum": "a8dce39801ea9267a0d4be7de41aa4ec",
"uncompressed_size_bytes": 4081821,
"compressed_size_bytes": 675009
},
"data/input/pl/krakow/osm/center.osm": {
"checksum": "562ed1102d3e2fc49d2b9eedf0f0d42a",
"uncompressed_size_bytes": 57269997,
@ -1565,6 +1580,11 @@
"uncompressed_size_bytes": 30680141,
"compressed_size_bytes": 10115339
},
"data/system/extra_fonts/NotoSansArabic-Regular.ttf": {
"checksum": "9f563abf8532ead724f2d6231983b5d4",
"uncompressed_size_bytes": 187000,
"compressed_size_bytes": 85904
},
"data/system/extra_fonts/NotoSerifCJKtc-Regular.otf": {
"checksum": "338584d1454293b6dfd84a9137153b3c",
"uncompressed_size_bytes": 23614420,
@ -2605,6 +2625,11 @@
"uncompressed_size_bytes": 61150098,
"compressed_size_bytes": 20025374
},
"data/system/ly/tripoli/maps/center.bin": {
"checksum": "e838565b7fc949da69c8f3e20c1afe7b",
"uncompressed_size_bytes": 36895843,
"compressed_size_bytes": 12687402
},
"data/system/pl/krakow/maps/center.bin": {
"checksum": "9149ad8ec339e328ed6ba07b8fc8e41a",
"uncompressed_size_bytes": 46032080,

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 480">
<rect width="960" height="480" fill="#239e46"/>
<rect width="960" height="360" fill="#000"/>
<rect width="960" height="120" fill="#e70013"/>
<circle cx="480" cy="240" r="60" fill="#fff"/>
<circle cx="492.132034" cy="240" r="52.132034" fill="#000"/>
<path d="M509.175411,240 589.875233,213.779039 540,282.426407V197.573593L589.875233,266.220961z" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

View File

@ -0,0 +1,9 @@
boundary
1
13.149948120117186 32.88074047366183
13.171062469482422 32.85752741152312
13.233890533447266 32.871369471965444
13.225650787353516 32.90322683541996
13.149948120117186 32.88074047366183
END
END

View File

@ -0,0 +1,16 @@
{
"osm_url": "http://download.geofabrik.de/africa/libya-latest.osm.pbf",
"map_config": {
"driving_side": "Right",
"bikes_can_use_bus_lanes": true,
"inferred_sidewalks": true,
"street_parking_spot_length": 8.0
},
"onstreet_parking": "JustOSM",
"public_offstreet_parking": "None",
"private_offstreet_parking": {
"FixedPerBldg": 10
},
"include_railroads": true,
"extra_buildings": null
}

View File

@ -41,23 +41,28 @@ impl MapLoader {
}
// TODO Generalize this more, maybe with some kind of country code -> font config
let chinese_font = "NotoSerifCJKtc-Regular.otf";
if name.city.country == "tw" && !ctx.is_font_loaded(chinese_font) {
return RawFileLoader::<A>::new(
ctx,
abstio::path(format!("system/extra_fonts/{}", chinese_font)),
Box::new(move |ctx, app, bytes| match bytes {
Ok(bytes) => {
ctx.load_font(chinese_font, bytes);
Transition::Replace(MapLoader::new(ctx, app, name, on_load))
}
Err(err) => Transition::Replace(PopupMsg::new(
ctx,
"Error",
vec![format!("Couldn't load {}", chinese_font), err.to_string()],
)),
}),
);
if let Some(extra_font) = match name.city.country.as_ref() {
"ly" => Some("NotoSansArabic-Regular.ttf"),
"tw" => Some("NotoSerifCJKtc-Regular.otf"),
_ => None,
} {
if !ctx.is_font_loaded(extra_font) {
return RawFileLoader::<A>::new(
ctx,
abstio::path(format!("system/extra_fonts/{}", extra_font)),
Box::new(move |ctx, app, bytes| match bytes {
Ok(bytes) => {
ctx.load_font(extra_font, bytes);
Transition::Replace(MapLoader::new(ctx, app, name, on_load))
}
Err(err) => Transition::Replace(PopupMsg::new(
ctx,
"Error",
vec![format!("Couldn't load {}", extra_font), err.to_string()],
)),
}),
);
}
}
FileLoader::<A, map_model::Map>::new(

View File

@ -137,6 +137,10 @@ pub fn nice_map_name(name: &MapName) -> &str {
("tel_aviv", "center") => "Tel Aviv (city center)",
_ => &name.map,
},
"ly" => match (name.city.city.as_ref(), name.map.as_ref()) {
("tripoli", "center") => "Tripoli",
_ => &name.map,
},
"pl" => match (name.city.city.as_ref(), name.map.as_ref()) {
("krakow", "center") => "Kraków (city center)",
("warsaw", "center") => "Warsaw (city center)",
@ -188,6 +192,7 @@ pub fn nice_country_name(code: &str) -> &str {
"fr" => "France",
"gb" => "Great Britain",
"il" => "Israel",
"ly" => "Libya",
"pl" => "Poland",
"tw" => "Taiwan",
"us" => "United States of America",

View File

@ -16,7 +16,7 @@ pub fn merge_short_roads(map: &mut RawMap) -> BTreeSet<NodeID> {
queue.push_back(*r);
// TODO Remove after improving this heuristic.
if connects_dual_carriageway(map, r) {
if false && connects_dual_carriageway(map, r) {
debug!("{} connects dual carriageways", r);
}
}

View File

@ -340,10 +340,12 @@ fn movement_geom(
for pl in &polylines {
if num_pts != pl.points().len() {
// Kiiiiinda spammy
/*warn!(
"Movement between {} and {} can't make nice geometry",
from, to
);*/
if false {
warn!(
"Movement between {} and {} can't make nice geometry",
from, to
);
}
return Ok(polylines[0].clone());
}
}