Closed korridor closed 3 years ago
Dear @korridor,
Thank you very much for your kind words. It was actually not possible to access the center coordinates in an easy way. What you can always do is to access the raw json data like follows:
result.elements()[0]._json
However, it is a good idea to include this functionality. This is why I have added it (will be in the release this night). The following code should now work:
zandvoort = nominatim.query('Zandvoort')
query = overpassQueryBuilder(area=zandvoort, elementType='way', selector='"highway"', includeCenter=True)
# or, alternatively: query = overpassQueryBuilder(area=zandvoort, elementType='way', selector='"highway"', out=['center', 'body'])
result = overpass.query(query)
``
Then, the center can be obtained as follows:
```python
result.elements()[0].centerLat()
# 52.3657055
result.elements()[0].centerLon()
# 4.5598827
I hope this is what you were looking for.
Best!
Thanks, just tried the new release and it works great!
First of all, thank you for this very practical package. I would like to do an overpass query that returns the center of ways as well. This basically works fine but I can't read the center coordinates from the result element. The query I performed looks something like this: