Skip to content

Support for multiline relations #439

Closed
Closed

Description

@flha127

Related threads #276 & #284

OHM currently only renders associatedStreet and multipolygon relations. It would be an improvement to have full support for multiline relations. To do this we could use a new "type=multiline" similar to "type=multipolygon". These objects unlike type=associatedStreet but like type=multipolygon are intended to be part of existing layers. A tram line type=multiline & railway=tram would join the transport_lines layer.

Activity

  1. changed the title [-]Support for relations[/-] [+]Support for multiline relations[/+] on Sep 11, 2022
  2. 1ec5 commented on Sep 11, 2022

    @1ec5
    Member

    FYI, type=multilinestring is much more common in OpenStreetMap.

  3. jeffreyameyer commented on Feb 28, 2024

    @jeffreyameyer
    Member

    @danrademacher - any progress here?

  4. Rub21 commented on Mar 18, 2024

    @Rub21
    Member

    A tram line type=multiline & railway=tram would join the transport_lines layer.

    For railway cases, it seems the tag is route=railway for relations: https://wiki.openstreetmap.org/wiki/Tag:route=railway. This tag joins all the pieces in one line, but it looks like we need to add the tag to each way piece as well. I am doing some tests to see if that can be done.

    Screenshot 2024-03-18 at 4 48 35 PM

    E.g https://www.openhistoricalmap.org/relation/2798877#map=9/-11.4639/-75.6862&layers=O&date=1949-07-07&daterange=1824-01-01,2024-12-31

  5. flha127 commented on Mar 19, 2024

    @flha127
    Author

    Good morning,
    This type of relationship is not really useful as it duplicates the tags already present in the members, see for example this line, it already has the tag "name"="Alton District (T&E Line)" which we find in the relationship.

    I agree with the proposal to use type=multilinestring and add a type=multipoints version to gradually remove the lines and points with attributes and replace them with type=multi... objects. This will result in a smaller database and makes it easier to check sources.
    I generally use a line tagged data_type=source with the quality and sources tags, then I have to copy and paste this line as many times as necessary to put the different attributes. With a type=multi object... we would only have this data_type=source line and as many relationships as necessary. And to check the sources, a simple search or query overpass works wonderfully see https://umap.openstreetmap.fr/fr/map/sources_963936#19/38.88948/-90.18436

  6. Rub21 commented on Mar 19, 2024

    @Rub21
    Member

    @flha127 , Good point,

    According to OSM the definition 👇

    Relation with type=multilinestring

    A discontiguous series of unclosed ways that semantically represents a single physical object. https://wiki.openstreetmap.org/wiki/Relation:multilinestring

    Relation with type=route

    like multilinestring but contiguous, forming a route that can be followed from end to end, Used to describe routes of various kinds. https://wiki.openstreetmap.org/wiki/Relation:route

    I am trying to understand which objects or relationships are going to be represented on which layers.

    For example, for Caminos del Inca, all chunk members have been tagged, but there was no relationship for the route, so I created a relationship that would represent Caminos del Inca. I think the route can be added to the transport_lines layer. However, in this case, the feature will not contain any highway=* attribute, so maybe it needs another layer like transport_routes and the same for other relationships that are going to use type=multilinestring.

    The Caminos del Inca could be tagged as type=multilinestring because it is a discontinuous series of ways, but it may still need to add route=road to recognize that is a route.

    https://www.openhistoricalmap.org/relation/2798886
    image

  7. flha127 commented on Mar 20, 2024

    @flha127
    Author

    Hi,
    As for route= with a mode of transport (train, bus...) I am also in favor of putting them in a separate transport_routes layer.

    As for route=road I would see a solution with two relationships :

    1. the first one with highway=, type=multilinestring and no ref= tag which goes into transport_lines. https://www.openhistoricalmap.org/relation/2798912#map=10/-15.1517/-74.4763&layers=O&date=1924-03-20&daterange=1824-01-01,2024-12-31
    2. the second with type=route and route=road which also goes into transport_lines.
      https://www.openhistoricalmap.org/relation/2798914

    The second relation would be used to display what we usually display in OSM with the ref=* tag, this would avoid having to duplicate the relations (or the lines currently) each time we change the route ref=* tag.

    The same thing could be done with railways with on one side a multilinestring object and on the other a type=route + route=railway object all going into transport_lines.

    The same thing could be done with railways with on one side a multilinestring object and on the other a type=route + route=railway object all going into transport_lines.
    1.
    https://www.openhistoricalmap.org/relation/2798921
    https://www.openhistoricalmap.org/relation/2798922
    2.
    https://www.openhistoricalmap.org/relation/2798920
    https://www.openhistoricalmap.org/relation/2798919
    https://www.openhistoricalmap.org/relation/2798918

  8. Rub21 commented on Mar 20, 2024

    @Rub21
    Member

    hi @flha127 , The relations as lines, cannot be added in the same transport_lines layer due to conflicts with the existing ways, but we can create another layer called transport_lines_relations. Regarding the two cases, it seems we can standardize, so in that way.

    Both relation cases, type=multilinestring and type=route, appear to be similar and can be included in the same layer. I agree with adding highway=* to type=multilinestring, and suggest it could also be added to type=route. I'm open to the possibility of including highway in both types. Regarding ref and name, if the route includes the ref tag in its attributes, it will be displayed in the vector tiles (Vtiles).

    https://vtiles-staging.openhistoricalmap.org/#13.76/38.88522/-90.17039
    image

    https://vtiles-staging.openhistoricalmap.org/#7.88/-9.964/-76.758
    image

    @danrademacher @batpad, would you be comfortable naming the new layer transport_lines_relations, or do you have any other recommendations?

  9. flha127 commented on Mar 20, 2024

    @flha127
    Author

    hi @flha127 , The relations as lines, cannot be added in the same transport_lines layer due to conflicts with the existing ways, but we can create another layer called transport_lines_relations.

    Hi,
    Multilinestring relationships are the multipolygons of ways.

    Multipolygons are as multilinestrings physical objects however they do not have their own layer, they are included in the same layers as regular polygons, the risk of making two separate layers is that in the long term the creators of renderers forget the layers specific to the relationships and all these contents will be hidden.
    In doing so we also have to duplicate all the elements in JSON files to display the elements of both transport_lines and transport_lines_relations (JSON does not support two layer sources for an element) therefore having to modify all existing JSON files.

    If there are overlapping relations and lines, JSON does not know how to display multiple overlapping labels so this does not pose a problem.

    In any case, if we duplicate the elements of the JSON file with the two layer sources there will be in all cases duplicated tags, whether the elements are in a single layer or not.

    (As of now, there are no multilinestring relationships, apart from 3 in eastern Europe, the test ones in Alton IL and the test ones in Peru)

    As for route relationships which are not physical objects, they can remain in a separate layer, we can even group them with other relationships (bus, train, etc.) in a generic "routes" layer.

  10. 6 remaining items

  11. flha127 commented on Mar 26, 2024

    @flha127
    Author

    Is it possible that this approach will have the same negative effects on routing as mentioned here? #94

    When you talk about routing, are you talking about this?
    https://www.openstreetmap.org/directions

    I have two assumptions:

    • if I remember correctly OSM for routing looks if two lines have a point in common and if yes then it can do routing even though for example a line is not split at each intersection;
    • in OHM when we export a multilinestring as with associatedStreets it does not export a single object but it takes each segment and pastes the attributes to it.

    Routing is not possible because of these same overlapping lines that we are talking about unless we spend hours merging every overlapping nodes so every single line is connected... currently working with overlapping lines is difficult there we would move to a level that would discourage any contributor.
    And that raises a new problem, my railway line was dismantled by the Germans in 1916... so I have a level crossing with start_date=1891/end_date=1916 and another with start_date=1920/end_date=1950 but I can't make these two elements coexist if the overlapping points must be merged... unless you use a type=point or multipoint relationship, so in the end we still have to use a relationship.

    Now this will seem very complicated but I assume that no contributor will be crazy enough to spend hours merging nodes so that all the lines are connected which is not possible anyway (previous point) .

    We start by making a query with the mode of transport then the date range:
    From there, instead of checking if the two lines have a point in common we will check that the GPS coordinates of points match and therefore assume that the lines are connected.
    It would probably take a while to calculate but at least it would allow multilestrings to be used.

    This sounds easier in ID. If there was a better time filter UI like an activateable timeslider to see only one point in time it could even be faster than figuring out and selecting the correct relation, but that is an other issue

    Open iD, set filter, select the line select the line select the line select the line change the date ; select the line select the line select the line select the line change the date, done.

    Open JOSM, select the relation change the date, select the relation change the date, done.

    Don't get me wrong, I don't want to appear stubborn or want to impose my way of doing things, I myself was very skeptical about this idea back in 2021 when the issue was first raised in #276 and #284, this is simply my feedback from hours spent with overlapping lines. Now, it is no longer experimental and there are no challenges to face, associated_street which is a multilinestring under another name already works (even if very little used), this would be a huge step forward to have objects type=multilinestring with the exact same tags as their single-line counterparts to come in use the same way multipolygons work both to avoid increasing the weight of the database with overlapping lines, by facilitating the rereading of sources and above all to make the work of contributors simpler.

  12. flha127 commented on Mar 26, 2024

    @flha127
    Author

    The relations as lines, cannot be added in the same transport_lines layer due to conflicts with the existing ways, but we can create another layer called transport_lines_relations.

    Hi @Rub21

    I was looking at the config.toml file for associatedStreets and its "datasets" osm_relations, osm_relation_members (I don't know how they are called precisely).

    For simple objects like lines, by integrating them into the datasets we change their tags to have a main type= tag like highway=primary which becomes class=highway+type=primary in transport_lines.

    If we plan to create datasets dedicated to each type of relationship (route_relations+route_relations_members/transport_relations+transport_relations_members) will this pose a problem if we proceed in the same way?
    For the route_relations dataset:
    From the OHM relation type=route+route=road to the route_relations dataset as class=route+type=road.
    For the transport_line_relations dataset:
    From the OHM relation type=multilinestring+highway=primary to the transport_relations dataset as class=highway+type=primary.
    This is in order to have, as for simple objects, a class= and a type= tags.

    Then we create providers.layers routes/transport_lines_relations from these datasets which export each member of the relation and paste the relation tags to it (in the same way as with associatedStreets). As this providers.layers is only made up of simple lines we can then, if we want, integrate them into existing layers via the maps.layers example
    [[maps.layers]]
    name = "transport_lines"
    provider_layer = "osm.transport_lines_relations"

    What do you think ?

  13. jeffreyameyer commented on Apr 12, 2024

    @jeffreyameyer
    Member

    What is the current recommended solution for mapping a line that might be referenced in a treaty? For example, how should the Greenville Treaty Line, be modeled/mapped? (Let's assume it's not just 1 or a few ways, but maybe 100) Seems like a route isn't correct, but a multilinestring would be cool. Not worried about rendering, but possibly returning in search results.

  14. jeffreyameyer commented on Apr 16, 2024

    @jeffreyameyer
    Member

    @Rub21 - where are we on answering @flha127's questions above? It seems like there are possibly some answers in #717, but I'm not sure if @flha127 has caught that.

    @1ec5 - any thoughts here? You suggested a forum post to clear this up a few posts back. Is that still valid? (seems that way to me)

    @danrademacher - I feel like the basic question of multilinestring support has been answered in some ways for routes, as Ruben has pointed out above, is that correct? This thread is more about how to construct a vector layer for some specific (but not all) routing needs, if I'm reading it correctly & it seems like we have quite a few tickets tied up in this discussion, mostly focused on routes & route styling, but not all multilinestring objects are routes (per my prior note).

  15. 1ec5 commented on Apr 16, 2024

    @1ec5
    Member

    What is the current recommended solution for mapping a line that might be referenced in a treaty? For example, how should the Greenville Treaty Line, be modeled/mapped? (Let's assume it's not just 1 or a few ways, but maybe 100) Seems like a route isn't correct, but a multilinestring would be cool. Not worried about rendering, but possibly returning in search results.

    I think in an ideal world, this is what we would mean by “boundary” – a claim line modeled as something geometrically similar to a route – whereas what we actually call a boundary would be a territory bounded by multiple boundaries. But unfortunately that isn’t how these concepts have developed in OSM and OHM.

    Instead, something like the Greenville Treaty Line, Mason–Dixon Line, or Line of Actual Control is modeled as a series of boundary ways with matching name and wikidata tags, similar to how we typically model roads. Geocoders are already in pretty good shape here: Nominatim is already capable of coalescing adjacent ways that represent the same road or boundary.

    A multilinestring relation could group these boundary ways together, though I don’t know that this generic relation type is actually an improvement over a more semantically specific boundary relation that is left unclosed.

  16. added theissue type on Mar 16, 2025
  17. Rub21 commented on Aug 14, 2025

    @Rub21
    Member

    The transport lines and multilines (relations that has transport tags) have been merged into a single layer, transport_lines (#934), which does not require styling as it already exists.

    Currently, the vector tiles support the routes layer, which comes mostly from relations, but we also include ways in a single route layer. The only thing missing now is the styling, which is being tracked in another ticket: #717
    https://vtiles.openhistoricalmap.org/#5.2/39.389/-78.273
    Image

    Seems good to close now this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions