User:Bjohas/Visualising relations

From OpenStreetMap Wiki
Jump to: navigation, search

Visualise tags attached to relation

How would you visualise tags attached to a relation? Is this possible? Would be good if this was the case. Would it be possible to create new points representing the relation? Or add relation information to member tags? Any ideas? Bjohas (talk) 11:12, 3 May 2017 (UTC)

Q1

For example, this query (adapted from here) produces a clickable relation:

[out:json][timeout:60];
area[name=Oregon] -> .OR;
rel[name="Multnomah County"](area.OR) -> .mc;
(rel.mc;);
out meta;
>;
out skel qt;
  • Overpass map: [1]
    • You can click on the yellow area, and the relation will pop up.

Q2

However, this one doesn't:

[out:json][timeout:120];
{{geocodeArea:"Mallorca"}}->.a;
{{objects="historic"~"archaeological_site|tomb"}}
relation[{{objects}}](area.a)->.p;
(rel.p;);
out meta;
>;
out skel qt;
  • Overpass map: [2]
    • In the returned data, there doesn't seem to be a place that can be clicked to see the relation.
    • I guess that's because the data is structured differently? So my question is: Why does Q1 produce the "clickable relation" but Q2 doesn't?
  • Overpass map with bb/center: [3]
    • Adding bb/center creates a clickable center/bb for the relation.
    • However, this requires a separate out statement - not a problem in this simple example, but essentially it means that the relations need to be processed separately. How do you achieve the same effect, but in a mixed set of rel/ways/nodes (and where only the relationships should be marked with bb or center)?

Answer provided by https://github.com/tyrasd, https://github.com/tyrasd/overpass-turbo/issues/293

This is basically by design. osmtogeojson handles the conversion of the data returned by overpass to GeoJSON, and it currently only supports multipolygon relations (and soon route relations, see tyrasd/osmtogeojson#1), but not (yet) the site relations from your second example. If it doesn't know anything about a certain relation type, it falls back to render the relation's members individually and adds the relation membership as a property to the respective features.

out bb / center is different, since then the relation members are not actually part of the result anymore and therefore osmtogeojson can only create a geometry for the whole relation.