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

Properly process alt_name tag when there are multiple entries separated by semicolon #581

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SiarheiFedartsou
Copy link

👋 I did some awesome work for the Pelias project and would love for everyone to have a look at it and provide feedback.


Here's the reason for this change 🚀

OSM's alt_name tag may contain multiple entries which are separated by semicolon (;) that's why I propose to split by it and use each entry as separate alias name.
See: https://wiki.openstreetmap.org/wiki/Key:alt_name#Examples
Example: https://www.openstreetmap.org/way/31151623

Screenshot 2024-11-29 at 14 49 26

Here's what actually got changed 👏

Just additional split call for alt_name tags :)


Here's how others can test the changes 👀

I added new test (which is almost copy-paste of one of existing ones though, but couldn't come up with better solution)

doc.setNameAlias( NAME_SCHEMA[key], val2 );
// `alt_name` may contain multiple names separated by semicolons
// (see https://wiki.openstreetmap.org/wiki/Key:alt_name#Examples)
if (key === 'alt_name') {
Copy link
Author

Choose a reason for hiding this comment

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

Tbh at glance it seems to be better to "bake" the fact that we need to split by something to NAME_SCHEMA, but it seems to be a bit of over-engineering for now (but let me know :) )

@SiarheiFedartsou SiarheiFedartsou marked this pull request as ready for review November 29, 2024 13:52
@missinglink
Copy link
Member

We're doing something similar already for addresses FYI:

// accept semi-colon delimited house numbers
// ref: https://github.com/pelias/openstreetmap/issues/21
var streetNumbers = (doc.getAddress('number') || '').split(';').map(Function.prototype.call, String.prototype.trim);

@missinglink
Copy link
Member

Seems this day has come 😆
#51 (comment)

@missinglink
Copy link
Member

FWIW I really hate this semicolon convention but it's here to stay 🤷‍♂️

@SiarheiFedartsou
Copy link
Author

We're doing something similar already for addresses FYI:

Do you think I should change this PR somehow to be aligned with this implementation? :)

@SiarheiFedartsou
Copy link
Author

Btw it seems alt_name:XXX (e.g. alt_name:en or alt_name:th) are not supported, or I am missing something?

@missinglink
Copy link
Member

Btw it seems alt_name:XXX (e.g. alt_name:en or alt_name:th) are not supported, or I am missing something?

For alt specifically? If so let's please open a new issue so we can discuss separately

@SiarheiFedartsou
Copy link
Author

Btw it seems alt_name:XXX (e.g. alt_name:en or alt_name:th) are not supported, or I am missing something?

For alt specifically? If so let's please open a new issue so we can discuss separately

Yep, please see #583

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

Successfully merging this pull request may close these issues.

2 participants