I'm building a mobile application. One of the features shows bus stops on a map. When the user zooms in far enough, bus stops should load for the area they are looking at. I have found part of the API that should help me do this: /api/0.6/map?bbox=left,bottom,right,top This should be called every time the user pans around the map so that it loads a fresh set of bus stops for that area. My problem is, when I do this I'm receiving way too much data that is not related to the bus stops. I need to see nodes only by user: NaPTAN (104459). Is there a way I can filter down the results like this? Essentially I need to be loading the bus stops every time the user pans across the map, for this to be productive the bus stops need to have been loaded ideally > 500 milliseconds and < 1 second. It would also probably be better to receive the files in JSON format rather than XML as this will save a chunk of bytes increasing download speed. If anyone can give me advice on the best way to do this I'd really appreciate it! Thanks asked 07 Sep '13, 13:26 jskidd3 |
The Overpass API allows to specify complex filters. It is also faster and more suited than the main API which is actually for editing and not for running bulk queries. Another option is to download the data in advance to store it locally. This way you are completely independent from the API and don't have to comply with the usage policy. answered 07 Sep '13, 19:39 scai ♦ |
As already stated Overpass should help you. Have a look how overpass-turbo does it: If you only need the coordinates: http://overpass-turbo.eu/s/10g If you need more details: http://overpass-turbo.eu/s/10h You will probably have to consider whether you really want to query for each single pan (or if it would be better to query a bigger bbox and only requery if the user leaves the bbox). /al answered 09 Sep '13, 11:31 _al |
you should not use API 0.6 for that, see it's usage policy - it is intended for editing only, and for such queries. There are alternative ways mentioned on the page, from setting up your own server syncing data with master openstreetmap servers, to using third party services. answered 07 Sep '13, 17:22 Matija Nalis |