[OSM-dev] Difficulty fetching data from API in own app, but not browser
nick.whitelegg at solent.ac.uk
Tue Jul 24 15:47:16 UTC 2018
As it happens there was a small bug in my code where certain exceptions were being thrown away without being caught so I missed what was going on.
Trying it again reveals the problem is location dependent, not frequency dependent - the error is always thrown near Haslemere, Surrey.
The error is an odd one and seems to be related to the XML parser within osmapi:
specifically "Error parsing XML at END_TAG, line 25670".
However if I download that XML in the browser for that exact bbox, it appears to be accepted as well-formed XML in Firefox and there's nothing odd in the XML at line 25670 (which is a </way> tag). Maybe it's an out-of-memory issue; if I consistently get the problem across different devices I'll contact the author of osmapi.
From: Simon Poole <simon at poole.ch>
Sent: 24 July 2018 07:43:18
To: dev at openstreetmap.org
Subject: Re: [OSM-dev] Difficulty fetching data from API in own app, but not browser
IMHO I would 1st verify that you are actually generating the same query (and the one your expect) with wireshark (running the app in the emulator) and that what is happening is actually a time out. It seems really really really unlikely to me that you are running in to the rate limiting.
2x2km can naturally be a lot of data, in particular if you have largish relations in the area (even if you are not downloading all the members).
Am 23.07.2018 um 18:19 schrieb Nick Whitelegg:
.... Digging a bit more, it looks like the API will reject a request if you make it relatively soon after the first; is this correct?
Is there a specific time limit between requests, i.e. you can only make requests every X seconds (if so, I can code this into my app)?
To make it absolutely clear - I am using the API for editing purposes. Specifically, the feature I'm testing at the moment allows you to download data from the API (2x2km square centred on current location), select ways and add/modify a designation tag.
From: Nick Whitelegg <nick.whitelegg at solent.ac.uk><mailto:nick.whitelegg at solent.ac.uk>
Sent: 23 July 2018 16:50:14
To: dev at openstreetmap.org<mailto:dev at openstreetmap.org>
Subject: [OSM-dev] Difficulty fetching data from API in own app, but not browser
Currently experiencing some inconsistent behaviour with the API in which fetching via the browser gives a response,
but my own app ('MapThePaths', part of a project intended to help map footpaths and edit designation tags in the UK) frequently hangs waiting for a response.
MapThePaths uses the osmapi (Tobias Zwick) to fetch data.
Is there any reason currently why the API might be responding to standard web browsers but not custom apps?
FWIW my app should be reporting itself as "MapThePaths Android app" and I have just (around 16:35-16:40 UK time) made three unsuccessful requests with the bbox: -0.7295872761598865,51.09355911139382,-0.7005316007485753,51.11122494429744.
Sometimes, however, my app is retrieving data from OSM successfully (perhaps 60-70% of the time).
No exception is thrown - just looks like a timeout.
I also observed similar behaviour 'in the field' yesterday afternoon when I was using the app in the countryside. The app could talk to my own API on mapthepaths.org.uk successfully but could not communicate with the OSM API.
Is this simply related to the issues with the OSM API at the moment related to moving to another server?
Senior Lecturer in Computing (Internet) | School of Media Arts and Technology
Southampton Solent University | RM424 | East Park Terrace | Southampton SO14 0YN
T: 023 8201 3075 | E: nick.whitelegg at solent.ac.uk<mailto:nick.whitelegg at solent.ac.uk> | W: solent.ac.uk<http://www.solent.ac.uk/>
dev mailing list
dev at openstreetmap.org<mailto:dev at openstreetmap.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dev