Hello every one, Just recently started getting acquainted with OSM. I have used the Map function in the python module osmapi to download a bounding box. My code is as follows:
I now want to get the list of ways inside this bounding box using python code. Is this possible? If so, would any one be so kind as to give pointers on how to go about doing so? Thank you asked 15 Mar '17, 16:29 imonike aseerel4c26 ♦ |
You shouldn't use that module if you just want to fetch data, it accesses an API intended for editing. Take a look at the Overpass module for accessing data: https://github.com/mvexel/overpass-api-python-wrapper Or maybe OSMAlchemy: https://pypi.python.org/pypi/OSMAlchemy/ I like to just write an Overpass script and embed that rather than using a wrapper. If you do intend to do programmatic editing, consider modifying the data using a script and then using JOSM to interact with the API (and be aware of the policy on automatic edits: http://wiki.openstreetmap.org/wiki/Automated_edits ). answered 15 Mar '17, 17:07 maxerickson Thanks so much maxerickson. I have come across the Overpass API, I guess it is time to dig in!! OSMAlchemy looks interesting. I still have a question, please don't be offended, it is really getting at my curiosity. Now the Map function I mentioned returns a list of dict objects that representing the nodes in the bounding longitudes and latitudes specified. If ways are a collection of nodes, isn't possible to get the list of ways I am looking for from the data I downloaded with the Map function? Thank you for your patience.
(16 Mar '17, 14:53)
imonike
I don't know the module. According to http://osmapi.metaodi.ch/#osmapi.OsmApi.OsmApi.Map the ways should be in the same dict.
(16 Mar '17, 17:41)
maxerickson
Thanks maxerickson. I really appreciate. I have visited that page. It's where I learnt about the Map function. Here is a fragment of the data returned:[{u'data': {u'changeset': 45126331, u'uid': 4384747, u'timestamp': datetime.datetime(2017, 1, 13, 7, 55, 35), u'lon': 88.5834267, u'visible': True, u'version': 3, u'user': u'\u30aa\u30c1\u30a2\u30a4\u30b3\u30e9\u30dc', u'lat': 23.806732, u'tag': {u'source': u'AND'}, u'id': 245716849}, u'type': u'node'},--I guess that would represent a single node. There are similar nodes in dict form making up a list. There doesn't seem to be anything to let u know which nodes make up a way. Tried using the NodeWays method but my conn was forcibly closed by the host. Guess my code was violating their download rules. Anyway started looking at the Overpass API. Many thanks for the help. Cheers
(17 Mar '17, 13:40)
imonike
|