NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

edit: I meant overpass not nominatum

Hi there, I have a map where I show small locations. In order to do so I send a query to Overpass-api (for example 'amenity=supermarket') , then when it gets back I filter out all the big brand names (from a local hand typed array) and display the result on the map.

To save time and data usage on both sides it would be great to filter the results on the overpass side before returning the result. For example 'if name and type has more then 10 locations in country x then remove from result'.

My question: is this even possible?

p.s. I know of a 'corporate' or 'chain' tag for shops, but it doesn's seem to be spread much so that's not of use, yet.

asked 15 Apr '19, 15:48

tijmenheid's gravatar image

tijmenheid
415511
accept rate: 0%

edited 16 Apr '19, 12:09


You can use a query like this one. The parameter for the number of equal named objects is in line 4.

Whether it makes sense if a different question. Note that there are many supermarkets with spelling variants in their name, keeping the less popular spelling variants intact. Or have combined names like "REWE Ihr Kaufpark", thus distinct from "REWE".

permanent link

answered 26 Apr '19, 19:01

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

Thanks Roland, the 'count' is indeed what I was looking for. (though the example doesn'T seem to work) For now the filtering I do with JS, and some tricks to filter out 'REWE Ihr Kaufpark' were a bit hard in the beginning but got it working now.

(02 May '19, 08:54) tijmenheid

You are not saying what infrastructure you are using (your own instance of Nominatim or some public one) nor if you would be able to change that. But what you are trying to do seems to me to be better served by the Overpass API. With that you can search for keys (e. g. amenity=supermarket), look in specific areas, count results and add/subtract result sets.

permanent link

answered 15 Apr '19, 17:30

TZorn's gravatar image

TZorn
12.3k764225
accept rate: 15%

Oops you're right I meant OVerpass-api, just corrected it. Searches work fine, but do you know of a way to filter searches before returning them? (I mean like the example I posted, not the general ones)

(16 Apr '19, 12:12) tijmenheid
2

I suggest you look at the language guide and the query examples linked to on the Overpass API page I quoted above. There you find examples of how to count and filter. If you still have issues post the query you are starting with here and someone can give you specific help (too advanced for myself).

(16 Apr '19, 13:58) TZorn

Thanks for the suggestion TZorn, will take another look, maybe I'll find something to fix it with.

(17 Apr '19, 14:21) tijmenheid

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×191
×181
×147
×66

question asked: 15 Apr '19, 15:48

question was seen: 2,745 times

last updated: 02 May '19, 08:54

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum