Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Saudi Arabia national shields #851

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions doc-img/shield_map_world.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions icons/shield_sa_national.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions shieldlib/src/shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ function getShieldDef(
return shieldDef;
}

export const arabizeRef = (ref) =>
ref.replaceAll(/[0-9]/g, (m) => String.fromCharCode(0x0660 + parseInt(m)));

/**
* Reformats an alphanumeric ref as Roman numerals, preserving any alphabetic
* suffix.
Expand Down Expand Up @@ -389,8 +392,15 @@ export function generateShieldCtx(
// Convert numbering systems. Normally alternative numbering systems should be
// tagged directly in ref=*, but some shields use different numbering systems
// for aesthetic reasons only.
if (routeDef.ref && shieldDef.numberingSystem === "roman") {
routeDef.ref = romanizeRef(routeDef.ref);
if (routeDef.ref) {
switch (shieldDef.numberingSystem) {
case "arab":
routeDef.ref = arabizeRef(routeDef.ref);
break;
case "roman":
routeDef.ref = romanizeRef(routeDef.ref);
break;
}
}

// Add the halo around modifier plaque text
Expand Down
14 changes: 14 additions & 0 deletions src/js/shield_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3458,6 +3458,20 @@ export function loadShields() {
},
};

// Saudi Arabia
shields["SA:national"] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, only one national route is mapped with network=SA:national, and all other routes are missing either the network=* tag or a relation altogether. But SA:national clearly represents a coherent network, and this could encourage local mappers to complete the tags for other routes.

The one network=SA:national route is what Saudi Arabia calls a “highway” route, as opposed to a “city road” or “branch road”. All three classifications are part of a nationwide system. Part of Highway 40 has been mapped redundantly as network=SA:highway. If we could get a local mapper to confirm their preference, that might also have the effect of encouraging more build-out of these route relations.

spriteBlank: "shield_sa_national",
textLayout: textConstraint("diamond"),
textColor: Color.shields.black,
numberingSystem: "arab",
padding: {
left: 3,
right: 2,
top: 4,
bottom: 3,
},
};

// Turkey
shields["TR:motorway"] = hexagonVerticalShield(
2,
Expand Down
4 changes: 4 additions & 0 deletions src/shieldtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ let networks = [
"AU:QLD:ALT",
"AU:QLD:ALT_S",
"AU:VIC:ALT_NR",

// With other numeral systems
"IN:NE",
"SA:national",
];

// Uncomment for a list of all supported networks. This makes for a very long page.
Expand Down