0

I'm having problems getting started with the overpass QL python library. I want to get a collection of ways that match the search criteria, but I can't seem to get anything but the points. I need to know which points belong with which ways so that I can draw them properly.

$ ipython
In [1]: import overpass
In [2]: api = overpass.API()
In [3]: ways_featureset = api.get('way(42.819,-73.881,42.820,-73.880);>;')
In [4]: ways_featureset['features'][0]
Out[4]: {"geometry": {"coordinates": [-73.8925346, 42.8155621], "type": "Point"}, "id": 42001122, "properties": {"highway": "traffic_signals"}, "type": "Feature"}
In [5]: non_points = [way for way in ways_featureset['features'] if way['geometry']['type'] != 'Point']
In [6]: non_points
Out[6]: []

I think that I need to do something similar to the "out skel" call, but you aren't able to do that in the library according to the docs (because the library handles appending out for you).

1

You need to set the verbosity of the get() output.

Try this:

>>> import overpass
>>> api = overpass.API()
>>> data = api.get('way(42.819,-73.881,42.820,-73.880);(._;>;)', verbosity='geom')
>>> [f for f in data.features  if f.geometry['type'] == "LineString"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.