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

India national expressway shield #676

Merged
merged 3 commits into from
Jan 26, 2023
Merged

India national expressway shield #676

merged 3 commits into from
Jan 26, 2023

Conversation

1ec5
Copy link
Member

@1ec5 1ec5 commented Jan 11, 2023

Added an India national expressway shield mostly identical to the national highway shield. Added a function to convert European numerals to Roman numerals, which are the distinguishing visual element of this shield.

Ghaziabad

Working towards #225.

src/js/shield_defs.js Outdated Show resolved Hide resolved
@@ -3385,6 +3385,10 @@ export function loadShields(shieldImages) {
bottom: 7,
},
};
shields["IN:NE"] = {
...shields["IN:NH"],
numberingSystem: "roman",
Copy link
Member Author

Choose a reason for hiding this comment

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

This touches on #465, but I think the NE shields are different than the other cases in that issue. It seems to be common to refer to the expressways by European numerals in writing, but shields or the gantry name signs mentioned in #225 (comment) mostly use Roman numerals. (I’ve come across photos of a few signs that use European numerals, but only as part of an entrance portal.)

Comment on lines +327 to +372
let roman =
"M".repeat(number / 1000) +
"D".repeat((number % 1000) / 500) +
"C".repeat((number % 500) / 100) +
"L".repeat((number % 100) / 50) +
"X".repeat((number % 50) / 10) +
"V".repeat((number % 10) / 5) +
"I".repeat(number % 5);
roman = roman
.replace("DCCCC", "CM")
.replace("CCCC", "CD")
.replace("LXXXX", "XC")
.replace("XXXX", "XL")
.replace("VIIII", "IX")
.replace("IIII", "IV");
Copy link
Member Author

Choose a reason for hiding this comment

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

There are NPM packages for converting to Roman numerals, which we could use instead of rolling our own. Either way, I’m thinking of this as a temporary polyfill until more browsers support numbering systems in Intl.NumberFormat.

Copy link
Member

Choose a reason for hiding this comment

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

So ref has an Arabic number, but the IRL sign has a roman numeral??

Copy link
Member Author

@1ec5 1ec5 Jan 11, 2023

Choose a reason for hiding this comment

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

That’s correct: #676 (comment). I’m asking for confirmation in the India Telegram chat, but so far it seems like the shield is the only context in which someone would use Roman numerals.

Copy link
Member

Choose a reason for hiding this comment

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

Somewhere we discussed countries that use Eastern Arabic Script numerals in their highway shields and I thought the expectation was that the "as shown on the sign" value is what would go in the ref tag. I'm wondering if we're doing the right thing for mapper feedback by doing the roman numeral conversion.

Copy link
Member Author

Choose a reason for hiding this comment

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

That discussion started in #465 and continued in #467 (comment). But I think the national expressways pose a different sort of challenge. If it turns out that “II” should only appear in a shield, while “2” should appear in text, then we’d be doing a disservice to non-renderers by encouraging mappers to essentially put ASCII art into ref.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going back to the subject of this thread, any opinion on pulling in a dependency versus relying on this homegrown implementation?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I'd defer to people that know how to program on that.

Copy link
Member

Choose a reason for hiding this comment

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

I think this implementation is okay until we can use Intl.NumberFormat. Fingers crossed that it won't be long.

@1ec5 1ec5 changed the title Added India national expressway shield India national expressway shield Jan 12, 2023
Copy link
Member

@claysmalley claysmalley left a comment

Choose a reason for hiding this comment

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

Looks good to me. Ideally we wouldn't need our own function to convert number formats, but I think this is okay as a proof of concept.

Added a function to convert European numerals to Roman numerals, which are the distinguishing feature of this shield.
@1ec5 1ec5 merged commit 3b66b3f into main Jan 26, 2023
@1ec5 1ec5 deleted the 1ec5-in-ne-225 branch January 26, 2023 17:56
@ZeLonewolf
Copy link
Member

I'm looking for a test location, in order to confirm that this still works in #714.

@1ec5
Copy link
Member Author

1ec5 commented Jan 27, 2023

I always link my screenshots to test locations. 🙂

@ZeLonewolf
Copy link
Member

Ohhhh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants