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

Reverse-geo results are broken for Japan -- Prefecture vs. Region #1463

Closed
jeffrey-friedl opened this issue Aug 15, 2019 · 12 comments
Closed

Comments

@jeffrey-friedl
Copy link

Nominatim is returning incorrect data in the "state" field for Japan. Japan's comparable administrative unit is "prefecture" (place=province, admin_level=4), but Nominatim is returning an unofficial "region" (place=region, admin_level=-) in the 'state' field of the return.

Here's an example:
https://nominatim.openstreetmap.org/reverse?accept-language=en&addressdetails=1&format=json&lat=34.986131846887&lon=135.74265446478

The results currently have a "state" of "Kinki Region", but it should be "Kyoto Prefecture".

The various "regions" in Japan play no part it official addressing in Japan. For those familiar with America, what's being returned here is comparable to "Boston, New England, USA".

FWIW, the actual "state" concept (place=state, admin_level=3) is not used within Japan.

@lonvia
Copy link
Member

lonvia commented Aug 19, 2019

Needs to be solved as part of #213.

@lonvia lonvia closed this as completed Aug 26, 2019
@jeffrey-friedl
Copy link
Author

Why has this been closed? The mistake has not been addressed, and still persists.

@lonvia
Copy link
Member

lonvia commented Aug 30, 2019

Because #213 already adresses the problem in general. There is nothing specific that can be done about this case in particular.

@jeffrey-friedl
Copy link
Author

#213 seems to be an ambitious, sweeping project that, based on the movement over the last five years, will probably never be.... (drum roll.....) addressed (rimshot!).

Digging a bit into https://github.com/OpenCageData/address-formatting, this bug (#1463) simply looks like a misconfiguration. The Japan portion within "worldwide.yaml" includes {{{state_district}}}, and that seems to be the problem. That bit should reference admin_level=4 (perhaps via {{{prefecture}}} ?). Neither "state" nor "district" should ever appear in any Japanese address.

The test case for Japan ("testcases/countries/jp.yaml") is factually incorrect in that the address given as "expected" would never be used as an address in Japan.

@freyfogle
Copy link

Hi Jeffrey,

well well well, we meet again. It's been a long time indeed since back in y! days. Hope life is treating you well.

Very happy to defer to your knowledge of Japan, and would welcome any improvements to the address-formatting repo. Honestly no idea where I got that Japan format from, probably one of the generic postal websites.

Bear in mind though nominatim does a mapping of admin_levels to terms, what you refer to as a prefecture, nominatim returns as "state". Hence why the templates have "state" in them. I am totally ignorant of whether that mapping is valid for Japan.

Anyway, happy to dive in. Can you please make a pull request with edits to the test and ideally additional tests in address-formatting and let's continue the conversation there.

If you're interested you might also want to take a look at the Perl code for processing the address-formatting templates: Geo::Address::Formatter

let's solve it.

@jeffrey-friedl
Copy link
Author

Hey there Ed! Can I ask where that admin_level mapping is done? The string "admin_level" doesn't appear in Geo::Address::Formatter nor in address-formatting-master. The problem is not the format as much as which raw data is pulled from OSM.....

@lonvia
Copy link
Member

lonvia commented Sep 3, 2019

Could I kindly ask that you discuss matters of the OpenCageData address formatter in its own github issue tracker? Thanks.

@freyfogle
Copy link

sure, but this is actually a nominatim issue. Jeffrey is right that the mapping of admin_level to terms like "state" happens in nominatim. Also nominatim unfortunately fails to map some admin_levels, though then oddly does include them in the display_name. Would be great is nominatim returned mappings for all levels in the address portion of the response. Agree though that is a separate issue.

@lonvia
Copy link
Member

lonvia commented Sep 3, 2019

There is a single world-wide list that assigns admin_levels to address terms. Changing this into something more country-specific is what #213 is about.
If you prefer address details with admin levels use the geocodejson format.

@freyfogle
Copy link

freyfogle commented Sep 3, 2019

thanks for making me aware, had not realized that about the geocodejson format

@pfcodes
Copy link

pfcodes commented Jul 23, 2023

There is a single world-wide list that assigns admin_levels to address terms. Changing this into something more country-specific is what #213 is about.
If you prefer address details with admin levels use the geocodejson format.

Geocodejson format solves this issue for me but it doesn't send country code which is the only thing preventing me from using it.

@lonvia
Copy link
Member

lonvia commented Jul 23, 2023

Please don't comment on 4 year old closed issues. Open a new one.

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

No branches or pull requests

4 participants