To search for a relation in Overpass Turbo, you can use Overpass QL (Query Language) to query relations based on specific criteria, such as tags, IDs, or geographic areas. Below are some examples and steps to help you search for relations effectively:
1. Search for a Relation by Tag
If you know the tag associated with the relation, you can query it directly. For example, to find relations with the tag route=hiking:
overpass
[out:json][timeout:25];
// Search for hiking routes in a specific area
{{geocodeArea:YourAreaName}}->.searchArea;
relation["route"="hiking"](area.searchArea);
out body;
Replace YourAreaName with the name of the area you want to search in (e.g., "Ireland").
2. Search for a Relation by ID
If you know the specific ID of the relation, you can query it directly using the rel() function:
overpass
[out:json][timeout:25];
// Fetch a relation by its ID
rel(1124369);
out body;
This example retrieves the relation with ID 1124369 and outputs its details.
3. Search for Relations Within an Area
To find all relations of a specific type within a geographic area, use the geocodeArea function:
overpass
[out:json][timeout:25];
// Fetch relations within a defined area
{{geocodeArea:Germany}}->.searchArea;
relation["admin_level"="4"](area.searchArea);
out geom;
This example retrieves administrative boundaries (admin_level=4) within Germany.
4. Retrieve All Ways and Nodes in a Relation
To get all ways and nodes that are part of a relation, you can use the recurse operator:
overpass
[out:json][timeout:25];
// Fetch a relation and its members
rel(1124369);
(._;>;);
out body;
The ._;>; part ensures that all members (ways and nodes) of the relation are included in the output.
5. Highlight Specific Features in a Relation
If you want to highlight specific features (e.g., bridges) within a relation, you can filter by additional tags:
overpass
[out:json][timeout:25];
// Search for bridges in a specific relation
rel["name"="Wild Atlantic Way"];
way(r)["bridge"];
out geom;
This example retrieves all bridges that are part of the "Wild Atlantic Way" relation.
6. Visualize Relations
Relations do not have their own geometry but are composed of ways and nodes. To visualize a relation, you need to include its members in the query. For example:
overpass
[out:json][timeout:25];
// Fetch and visualize a relation and its members
rel(1124369);
(._;>;);
out geom;
This query ensures that the relation's geometry is displayed on the map.
Tips for Using Overpass Turbo
Use the Wizard in Overpass Turbo for simpler queries. For example, type route=hiking in Ireland and let the wizard generate the query.
Use {{geocodeArea:AreaName}} to define a geographic area for your search.
Use out geom to visualize results on the map or out body for raw data.
These examples should help you effectively search for and work with relations in Overpass Turbo.