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

Wildcard search #22

Closed
timmrk opened this issue Apr 10, 2018 · 3 comments
Closed

Wildcard search #22

timmrk opened this issue Apr 10, 2018 · 3 comments

Comments

@timmrk
Copy link

timmrk commented Apr 10, 2018

In the current state you can just search for exact key value pairs in the loaded XML/data.
For example: "highway => residential" or "country => FR" in the search-Method.

I dont know if the OSM API has some kind of wildcard search already. But i do know that the Overpass/Turbo API has a Wildcard Search in the form of "key=*" . Overpass Tag Search.

It would be nice if you can perform an wildcard search, like if you want to get all highway-types from an loaded Area.

kenguest added a commit that referenced this issue Apr 11, 2018
@kenguest
Copy link
Member

@timmrk does the fix that I've committed in 1c26666 work the way you would like?

@timmrk
Copy link
Author

timmrk commented Apr 13, 2018

Hello,

yes it works as i thought it should.
My Code for Using it in my Programm looks like this:

$results = $osm->search(array("highway" => "*"));
foreach ($results as $result) {
      $name = $result->getTag('name');
      if (!in_array($name, $resultarray)){
          $resultarray[]=$name;
      }
}

This way it give my for example all streetnames of all streettypes back. Additionally in the Code i check if the Name exists in the array, to not have duplicates. Thank you!

@kenguest
Copy link
Member

Excellent :-) Unless you can think of any directly related enhancements for this, I'm going to consider closing this issue as fixed, thanks!

kenguest added a commit that referenced this issue May 13, 2020
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

No branches or pull requests

2 participants