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

[OSM] Handle only the first result of the city search #8

Open
OhmSpectator opened this issue Jan 25, 2020 · 1 comment
Open

[OSM] Handle only the first result of the city search #8

OhmSpectator opened this issue Jan 25, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@OhmSpectator
Copy link
Owner

OhmSpectator commented Jan 25, 2020

For example: "--city Berlin" returns besides german one, a city in the USA.

In overpass-turbo API there is an extension that returns only the first appearance ({{geocodeArea:name}}). Implement something like this.

Useful links:

@OhmSpectator OhmSpectator added the enhancement New feature or request label Jan 25, 2020
@OhmSpectator OhmSpectator changed the title Handle only the first result of the city search [OSM] Handle only the first result of the city search Nov 20, 2022
@OhmSpectator
Copy link
Owner Author

OhmSpectator commented Dec 8, 2022

To retrieve only the ways for the area that corresponds to the first occurrence of the {city} parameter, you can use the following query:

area[name="{city}"][1];
(way["highway"](area); >;);
out skel;

The [1] operator in the area parameter specifies that only the first matching area should be returned. This ensures that you will only get the ways for the Berlin in Germany and not in the USA or any other place with the same name.

OhmSpectator added a commit that referenced this issue Dec 8, 2022
The previous query was returning all matching areas for the `{city}` parameter,
which could cause problems if the city name was used in multiple locations.
This commit modifies the query to use the `[1]` operator in the `area`
parameter, which ensures that only the first matching area is returned.
This improves the reliability and accuracy of the query results.

Issue: #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant