simo_fi
(Simo Fi)
December 18, 2023, 10:29am
1
this query selects two “alpine_hut” with some tags,
[out:json][timeout:30];(
node(1085925753);node(6866498286);
); out body;
I would like to filter tags of interest to me: name, ele, tourism, website
and remove all others (phone, fee, addr:, contact: )
I know I can create a csv but it’s not good for my purpose;
I want to keep the data in json format
any suggestions?
Kovoschiz
(Kovoschiz)
December 18, 2023, 12:16pm
2
foreach
{
convert MyType osm_type = type(), ::id= id(), ::geom = geom(),
tourism = t["tourism"],
name = t["name"],
ele = t["ele"],
website = t["website"];
out geom;
};
And you can use comma for multiple objects overpass turbo
2 Likes
simo_fi
(Simo Fi)
December 18, 2023, 1:12pm
3
Thanks Kovoschiz for the reply
I had tried convert statement but it discards geometry (lat/lon info)
the results are not visible on the maps
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#The_statement_convert
original output:
{
“type”: “node”,
“id”: 1085925753,
“lat”: 43.7961269,
“lon”: 11.7898353,
…
}
output with convert:
{
“type”: “MyType”,
“id”: 1085925753,
“geometry”: {
“type”: “Point”,
“coordinates”: [ 11.7898353, 43.7961269 ]
},
…
}
simo_fi
(Simo Fi)
December 20, 2023, 11:27am
4
ok with convert I can filter the tags and I get a json. . . but I don’t see the results on the map
it’s also strange because latitude & longitude data exists (in different format )
you can try this request with and without convert statement:
[overpass turbo ]
json data differs in location format
thanks for the suggestions
DaveF
(Dave F)
January 13, 2024, 7:44pm
5
FYI The foreach
command isn’t required.
[out:json];
node(id:1085925753,6866498286);
convert MyType
osm_type = type(),
::id= id(),
::geom = geom(),
tourism = t[“tourism”],
name = t[“name”],
ele = t[“ele”],
website = t[“website”];
out geom;
1 Like