atorger / nvdb2osm

The Unlicense
9 stars 2 forks source link

Generate highway=*_link #20

Closed atorger closed 3 years ago

atorger commented 3 years ago

It's a bit of a hack, but by subtracting FPVKLASS from DOUKLASS one can find link roads, as long as you make sure you don't use DOUKLASS from roads not represented in FPVKLASS.

Notes:

"AGGREGATLevkval_DoU_2017" => DOUKLASS 1 - 6

    # check if we should make this a link
    if tags.get("highway", None) in ['motorway', 'trunk', 'primary'] and way.tags.get("junction", None) != "roundabout":
        fpv_klass = way.tags.get("FPVKLASS", None)
        dou_klass = int(way.tags.get("DOUKLASS", 1000))
        if fpv_klass is None and dou_klass < 4:
            tags['highway'] += "_link"
atorger commented 3 years ago

NVDB_DKStamvag may be an interesting layer in this context.

NKAmapper commented 3 years ago

I had a look at Stamveg, but it did not seem to contain any specific attributes for the on-ramp/off-ramp sections.

I agree the above solution is a bit of a hack, but the quality of FPV Class and DoU Class seem consistent. I believe this data is produced centrally by Trafikverket, rather than by many different people in municipalities and counties.

atorger commented 3 years ago

I haven't had time to study this, but you have in the layers Gatunamn and Vägnummer (ie for city roads and numbered roads) the field ROLL, which might be useful in this and similar contexts:

1: Normal 2: Syskon fram 3: Syskon bak 4: Gren

"Länkroll för gatunamn.Länkroll beskriver ett vägavsnittsroll. Syskonlänkar används när enväg har skilda körbanor. Grenanvänds för förbindelsevägar, t.ex.avfartsramper eller delar av encirkulationsplats."

This document has quite detailed info about how this and related properties are supposed to be used https://www.trafikverket.se/contentassets/e0faf1739d244cb384aadf8c1f7a91dd/oversikt_vagdata_v4.0.pdf But as always, one need to look at how they are actually used too...

atorger commented 3 years ago

Tests in Malmö.

The image below is with the DOUKLASS method, more specifically with this JOSM find filter:

DOUKLASS<4 (highway=motorway OR highway=trunk OR highway=primary) -junction=roundabout FPVKLASS=

that is select motorway, trink and primary roads if DOUKLASS less than 4, it's not a roundabout and FPVKLASS is not set:

image

The result is quite okay, but we can't get secondary or tertiary links with this filter, and it does get some falsely included as links, seen as the two parallel ways at the top.

Here's the same section using this filter:

ROLL=Gren -junction=roundabout (highway=motorway OR highway=trunk OR highway=primary OR highway=secondary OR highway=tertiary)

ie, select all ROLL=Gren which is not roundabouts and is included in motorway to tertiary:

image

The result is better and more complete. There's still an error (same as in DOUKLASS method), the top left of the four rounded links in the bottom right of the image is still not selected. It's marked as Syskon, which is simply just a data error in NVDB.

atorger commented 3 years ago

Here's a zoom-in on the roundabout at the top. Note that we do get the links that pass by the roundabout, which takes care of this from the OSM highway link wiki: "_link tags should also be used for physical channelization of turning traffic lanes at traffic signal junctions and in roundabout designs that physically separate a specific turn from the main roundabout. "

image

We also get these though, and I'm not as sure that these turning places should be marked as link, but I guess we can live with that:

image

atorger commented 3 years ago

The above solution has been pushed to main

NKAmapper commented 3 years ago

Agree, "roll" is better. It was not available in Homogeniserad.

In the Norwegian NVDB we have an additional attribute which is used for identifying the cases of a "gren" where a short branch from a trunk/primary is used for a rest area, parking, bus terminal and similar, but I have not been able to find anything like that so far here. At least we get _link in those cases.

atorger commented 3 years ago

I haven't actually looked at the homogeniserad format. I have noted when I read it in separate layers there's quite lot of issues of conflicting values and overlaps, like different names on roads, sometimes different maxspeeds etc. I've done my own resolving algorithm for that, looking at date and specifying priorities depending on different properties. I guess some minor differences could occur due to this compared to using homogeniserad format, but I don't think it should be a big issue.