Format JSON my city villages and streets?

I wonder is it somehow possible to make JSON with QL query like:
MyCity: {
villages: {…}
streets: {…}
}
I’m sorry if the question is bad I’m just a beginner

1 Like

You mean something like http://overpass-turbo.eu/ ?
In wizard you would type something like place=* or highway=* in Zagreb ?

1 Like

Yes overpass I try this

[out:json][timeout:25];
// fetch area “Andorra” to search in
{{geocodeArea:Tomislavgrad}}->.searchArea;
// gather results
(
  node[place~"city|town|village|hamlet|addr|street"](area.searchArea);
);
// print results
out body;
>;
out skel qt;

But I don’t get almost anything I want to get json something like this

Tomislavgrad: {
villages: {},
streets: {}
}

Ofc it will be more complex but I just don’t know how or even is it possible to group stuff like this.

1 Like

Try changing “node” into “nwr”, that is node/way/relation. See also Key:place.

3 Likes

Well you can easily get JSON for villages part, and JSON for streets part via two different queries. Then it is simple matter of combining two JSON files into one (e.g. using something like jq(1) on GNU/Linux system, or even your web browser’s javascript)

It might be possible to do it using overpass loops, but you’d probably have to become overpass expert first :smile: (and it might end up being too slow). Unless you’re ready to invest yourself that way, I’d recommend method above with two simple separate queries and combining JSONs yourself.