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

Remove periods from openstreetmap webkit search #1617

Conversation

DaveSch-gramps
Copy link
Contributor

OpenStreetMap's Nomiatim does not like abbreviations in place like "U.S.A." or "p.E.I."; Prince Edward Island.

The added line strips periods "." from the place name before sending it out to the URL

Bug report https://gramps-project.org/bugs/view.php?id=13085

OpenStreetMap's Nomiatim does not like abbreviations in place like "U.S.A." or "p.E.I."; Prince Edward Island.

The added line strips perionds "." from the place name before sending it out to the URL
@hgohel
Copy link
Member

hgohel commented Dec 7, 2023

The behavior of OSM's search query doesn't seem consistent to me. As you found, "U.S.A." seems to throw it off and returns no results for valid addresses. However, if using the Spanish version "E.U." for USA, it returns results only when the periods are included, and if periods are removed, no results. This leads me to think this change needs testing for addresses in other languages.

@DaveSch-gramps
Copy link
Contributor Author

@hgohel

I just tried a search "Segovia, Castile and León, España, E.U." and no results were returned. and again with "EU" with no results. Removing any reference to the E.U. returned results. And yes, wherever possible, I use the endonymn for place names even though I am in the U.S..

https://nominatim.openstreetmap.org/ui/search.html?q=Segovia%2C+Castile+and+Le%C3%B3n%2C+Espa%C3%B1a%2C+E.U.

Could you provide specific searches and their results.

It may turn out that a universal fix is not be possible from within Gramps. I'll raise an issue report in the Nominatim github.

@hgohel
Copy link
Member

hgohel commented Dec 9, 2023

Hi @DaveSch-gramps In my response I didn't make it clear that "E.U." was an abbreviation for Estados Unidos, United States in Spanish, rather than European Union. So any US address with a country name "E.U." is found but not found with "EU". As an example, "empire state building, new york, ny, e.u."
I tend to agree with you that Gramps may not be the place to try and fix this without understanding of the impact; it may be better to learn more about Nominatim search. Thanks.

@DaveSch-gramps
Copy link
Contributor Author

@hgohel My fault. Rereading (more carefully) your initial post does say E.U. for the United States.

Looking at the Nominatim page for the United States, there is a long list of all the variations of the name by language including official_name, short_name, old_name as well as both 2 and 3 letter language codes. According to the list, none of them are E.U.

https://nominatim.openstreetmap.org/ui/details.html?osmtype=R&osmid=148838&class=boundary

EE.UU. (short_name:es)
É.-U. (short_name:fr)

Maybe it thinks your country entry is French.

As a test, I just changed my U.S.A. to "Amerikan yhdysvallat", Finnish for the United States. "Boston, Suffolk, Massachusetts, Amerikan yhdysvallat" is found! where "Boston, Suffolk, Massachusetts, U.S.A." is not! The key appears to be this list.

@hgohel
Copy link
Member

hgohel commented Dec 9, 2023

Hmm. Right, no "E.U." in the list, but "E.-U." with the dash/hyphen is odd. Anyway, the list you shared shows that (1) periods in names are valid, and removing isn't always the right thing to do, and (2) U.S.A. (with periods) isn't in the list so not receiving results is "expected." Should it be up to Gramps to always remove periods? My vote would be no. Maybe Gramps online help can point users to a wiki to to get better results (if there is one)?

@DaveSch-gramps
Copy link
Contributor Author

I can change the PR to only change U.S.A. to USA without affecting any other periods users may have But does make the PR specific for my use.

The alternative is to sign up for an account to OpenStreetMaps and find out how to add U.S.A. as a name possibility.

@Nick-Hall Nick-Hall added the bug label Feb 6, 2024
@Nick-Hall
Copy link
Member

The punctuation is stripped out of the search anyway. The problem is that "U.S.A." becomes "U S A" in the query which is not listed.

In general, I think that stripping out the periods would probably be beneficial.

@DaveSch-gramps
Copy link
Contributor Author

DaveSch-gramps commented Feb 7, 2024

I stripped out my patch and sent a query and the punctuation was not stripped out. My query: Basin, Big Horn Co, Wyoming, U.S.A.

Is OSM doing something different with queries from the U.K.??

@hgohel pointed out that searches from Spain would NOT benefit having the periods stripped out.

The patch strips the period (.) out without adding spaces. I expected this patch would not be merged but left as a fix for those that would need it. I myself could just change my Gramps record for the "United States" to make it work.

I signed up for an OSM account but cannot see where I can have "U.S.A." added to the list of options.

@Nick-Hall
Copy link
Member

Look at the debug output. The transliterated query is:

<basin,big horn co,wyoming,u s a>

If we strip out the periods the query becomes:

<basin,big horn co,wyoming,usa>

@hgohel found the opposite case. Since "E.-U." is in the list, it will match "E U", and any query such as "E*U" will also match. "EU" is not in the list, so in this case stripping out the "." is bad.

The UK works quite well. It will match "UK", "U.K." and "GB", but not "G.B.".

@Nick-Hall Nick-Hall changed the title Update openstreetmap.py Remove periods from openstreetmap webkit search Feb 7, 2024
@DaveSch-gramps DaveSch-gramps closed this by deleting the head repository May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants