osm-python-tools
osm-python-tools copied to clipboard
Allow iteration through NominatimResult json
Nominatim.query returns a NominatimResult object.
To my understanding there is no way of iterating through the query results stored in NominatimResult._json(besides calling NominatimResult.toJSON). Instead, the various methods displayName, address etc loop through the results and return the first valid value they find.
This is extremely misleading to me, as if I write something like
response = Nominatim().query(...)
print(response. displayName())
print(response. address())
name and address could in theory belong to two different osm object (e.g. first and second result in the json array).
What instead would be natural imho is to have Nominatim.query returning an iterable, so that I can inspect the various results individually.
Am I missing something?