I have two requests to get supermarkets within a country but both are slow and I'm asking myself if there is a way to improve them. The first query is used to get supermarkets in France only, within a radius of 2 kilometers around the coordinates provided :
(In this example, the coordinates correspond to the location of Paris). For the second request, I want to obtain supermarkets in France only as well but sorted by brand and city. Currently, I use the query below to get all the supermarkets in a given city (but it's not limited to France). After my request, I sort the results by brand in my code.
Is it possible to improve both queries and make them faster? I'd also like to limit the second query to France, and why not, if it's more efficient sort the results by brand with the API and not with my code. asked 13 Aug '19, 15:21 Arouraz |
The Default timeout value is 180. Setting it to 40 isn't required. Depending on what you want to do with the output data, converting it to json is often unnecessary. Quotation marks are only needed when a colon is in the expression. Specifying France isn't required as the As there's only one line of code the containing brackets aren't required
There's quire a few areas with Paris as it's name. Best to specify a single one. I used this one https://www.openstreetmap.org/relation/7444, If you wish to use another relation, add its id to 3600000000 to get the area id. If you're only using using a single area once, then there's no need to store it in a variable (RESULTS).
I think relation 2202162 is the incorrect one to use for mainland France: answered 19 Aug '19, 18:04 DaveF |
please note that supermarkets (and POIs in general) can also be mapped as ways or as relations. You have to use 'nwr' instead of 'node'
I didn't know that, I updated the code, thank you!