Adjust filter criteria for overpass turbo

Hello,

I want to adjust the example code I found on wiki here

I want to output the number of pharmacies for every region in Germany instead of just the ones starting with “057”. I need all the region IDs with exactly 5 characters. Fewer characters is a bigger region and more a smaller.

Does anyone know how to output only the region and number of pharmacies in the csv file whose IDs have 5 characters?

Greetings
matty

What about

area["de:regionalschluessel"~"^.....$"];

Every dot stands for a single character.

But maybe,haven’t tried:

area["de:regionalschluessel"~"^.{5}$"];

will work also.

That works so far, thank you! But a problem is that the “region key” doesn’t seem to be the same classification as NUTS classifications.

https://wiki.openstreetmap.org/wiki/NUTS_and_LAU#Country-specific_tagging_guidelines_for_NUTS/LAU_regions

Is it possible to use these tags and change the filter so that the script outputs the number of pharmacies in each NUTS 3 region in Germany ?

I don’t know what NUTS and LAU is, sorry. I can’t remember having seen that being mapped before.
Do others know and have mapped that in DE? How well is is_in:nuts:3 mapped in DE?

Could I just put is_in:nuts:3 in the code and test it, to see what number of pharmacies it brings up?

How would the argument look like?

According to the link to the OSM-wiki you provided,‘is_in:nuts’ is deprecated.
That wouldn’t help, peoples might have deleted those tags?

You could use

area["ref:nuts:3"~"^DE"];

instead of

area["de:regionalschluessel"~"^057"];

searching for any value level 3 value in DE.
But don’t expect to many results: as said, I’ve not seen much of them.

Example
City of Munich has ref:nuts:3 = DE212
County of Munich does not have ref:nuts:3 set

Just make your own tests for completeness of ref:nuts:3 before relying on the results.
Or compare the number of ‘regions’ of the query with the real number of ‘regions’ in DE.

Seems to be complete for DE:

If you put this into the input for https://overpass-turbo.eu/

[out:json][timeout:25];
(
  relation["ref:nuts:3"~'^DE']({{bbox}});
);
out body;
>;
out skel qt;

Yeah, I see, 'cause it was focusing on Roma, Italy not on entire Germany.

Try this one:

start it (“Ausführen”) and accept the 100 MB output and slow browser and wait …

Thank you very much, now it works! Maybe I can use the map in my work too.

To change the code for counting gas stations instead of pharmacies, I can just use

 ( node(area.regio)[amenity=fuel];
    way(area.regio)[amenity=fuel];
    rel(area.regio)[amenity=fuel];);

right?

Is there anyway to extract this data for different years?
Example
Number of nodes 2020
Number of nodes 2021
Number of nodes 2022

Or is there no archive and only current data that can be looked at?

Just have a look @ the documentation of the Overpass API, I can’t say that.

Examples and a German example for asking data of a specific day -maybe 2020-12-31, 2021-12-31,… in your case.

You have marked this as “solved”, so I no longer can answer directly to a question.

If you have a new question, please start a new thread.

I don’t know what the second code you sent would do. I doesn’t work for me.
But the first one with changing the argument to

area["ref:nuts:3"~"^DE"];

looks really promising! It outputs the amount of pharmacies for 402 regions. 402 is the exact amount of NUTS 3 regions in Germany. I will test around further and write back if something doesnt work.

Thank you very much, you’ve been a great help!