Skip to content

Syntactic problems with specifying a rare map layout (not a code bug report!) #17

@gwselke

Description

@gwselke

For a map that I am currently working on, I find a curious state of affairs in The Real World which I struggle to accommodate in the Map::Tube map syntax. (This is for XML, but I think the same applies to JSON.)

Here is a stripped down version of the situation:

Line X (id x): A <-> B <-> C
Line Y (id y): A -> B -> C -> D -> A (unidirectional; no direct link (neighbour) from B to A)

The best I can come up for the map data is then:

<station id="A" name="A street" line="x,y" link="B"/>
<station id="B" name="B street" line="x,y" link="A,C"/>
<station id="C" name="C street" line="x,y" link="B,D"/>
<station id="D" name="D street" line="y"   link="A"/>

But here the information is lost that, while there is a direct link from B to A using Line X, there is no (direct) link from B to A using Line Y. Consequently, get_shortest_route( 'B street', 'A street' )->preferred will yield
B street (LineX, LineY), A street (LineX, LineY)
instead of
B street (LineX), A street (LineX)

I do not think this is a bug in Map::Tube::get_shortest_path( ) or in preferred( ), since the result is compatible with what the map says. The issue is rather that the map does not say what I need it to say. And I have found no way of making it say what I want it to say.

This is certainly a rare edge case, and the consequences are very mild (the result being just slightly off). I am not sure whether such a case can be modelled given the current XML (or JSON) syntax. But changing the syntax would almost certainly break many existing applications, and that should certainly be avoided. Also, the effort may be too big for little gain. So this should not be regarded as a bug report, but as food for thought -- maybe there is an easy way to express this, after all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions