Giter VIP home page Giter VIP logo

nvdb2osm's Introduction

nvdb2osm

Converts NVDB highway data to OSM file.

To replace elveg2osm. Supports v3 of NVDB (2020 onward) and more features/tags.

NVDB conversion for Sweden is here.

Usage

  1. nvdb2osm -vegnett <"kommune">

    • Produces OSM file with road network for a given municipality (name or 4 digit municipality code), or "Norway" for all municipalities.
    • Example: nvdb2osm -vegnett 4601for the road network of Bergen.
  2. nvdb2osm -vegobjekt <"vegobjektkode"> [ <"kommune"> ]

    • Produces OSM file with all road objects of a given type (name or 2-3 digit object code).
    • Optionally within a given municipality (name or 4 digit municipality code), else for the entire country of Norway.
    • Example: nvdb2osm -vegobjekt 103 0301 for all traffic calming/speed bumps in Oslo.
  3. nvdb2osm -vegref <"vegreferanse">

    • Produces OSM file with road network for given road reference code.
    • Example: nvdb2osm -vegref RA3 for Rv3 under construction (A).
    • The reference code is found by clicking on a road in vegkart.no v3.
  4. nvdb2osm -vegurl <"api url">

    • Produces OSM file defined by given NVDB API URL from vegkart.no v3 or any other permitted API URL as described in the NVDB API documentation.
    • &srid=wgs84 automatically added to the API URL string.
    • Bounding box only supported for WGS84 coordinates, not UTM from vegkart.no v3 (you will need to remove it or convert to WGS84).
    • Please make sure that inkluder=lokasjon,egenskaper,metadata,geometri,vegsegmenter is included in the API URL string.
    • Example 1: nvdb2osm -vegurl "https://nvdbapiles-v3.atlas.vegvesen.no/vegobjekter/532?segmentering=true&inkluder=lokasjon,egenskaper,metadata,geometri,vegsegmenter&egenskap=4567=7041" for all construction road objects in Norway (NB: Less detailed than a road network).
    • Example 2: Swap 7041 with 12160 in example 1 to get cycleways under construction.
    • The API URL is found by following this procedure:
      • Searching for a feature in vegkart.no v3 (see vegkart tutorial )
      • Click "xx vegobjekter".
      • Copy the link behind "API" below the list.
      • Remove the bounding box in the copied link if any (or convert it to WGS84 coordinates).
    • You may want to test the API URL in your web-browser.

Optional arguments:

  • -date "dato" - Only ouput highways with coordinates provided during given date, e.g. "2020-08" for August 2020, or "2020" for full year.
  • -debug - Get detailed information from NVDB
  • -segmentert - Get segmented road network, i.e. road segments are not combined into longer ways.
  • <"filnavn.osm"> - Set output filename (must end with ".osm")
  • <"kommunenummer">- For Norway batch runs, (re)start with the given 4 digit municipality number.

Generated OSM files

  • Generated OSM files for all Norwegian municipalities in this folder.
  • You may generate updated files using Python 3. No external dependencies beyond standard Python.

Supported features

  • Roads will get tagging for the following features:
    • Highway, including linked on/off ramps.
    • Ref (2-3 digit county roads will get primary tagging, otherwise secondary).
    • One-way streets.
    • Roundabouts.
    • Turn:lanes (may need to be adjusted manually; enable "Lane and road attributes" style in JOSM).
    • PSV lanes.
    • Tunnels and bridges.
  • The following additional road objects from NVDB at the way level are supported:
    • Motorways and motorroads.
    • Tertiary roads based on NVDB functional road class (maintained in NVDB only in a few municipalities, e.g. Oslo).
    • Street names.
    • Max speeds.
    • Max height.
    • Max weight, for bridges only.
    • Max length, for tertiary and higher road classes.
    • Surface (asphalt excluded).
    • No snowplowing (national and county roads only).
    • Access restrictions.
    • Tunnel names, descriptions and access restrictions for bicycle and pedestrians.
    • Bridge descriptions (may currently mix left/right sides).
  • The following road objects at the node level are supported. They may need manual inspection to ensure a better position.
    • Motorway junctions (needs to be moved to the correct off-ramp junction).
    • Ferry terminals.
    • Pedestrian crossings.
    • Railway crossings.
    • Speed bumps (tables).
    • Traffic signals (may need more traffic signal nodes at the junction) .
    • Barriers.
    • Cattle grids.
    • Passing places.
    • Stop signs (few cases).
  • Turn restrictions are supported (relations).

Current limitations

  • Road objects will currently not get tagging for info from other road objects, such as speed limit, name, barrier etc.
  • For road objects, the OSM file will contain info tags for all object data attributes from NVDB in its original format, with only limited OSM tagging supported. You will need to convert the info tagging to proper OSM tagging. Referenced roads will get osm tagging automatically.
  • Please observe that road object will only produce the centre line of the road, while road network will get all separate left/right ways, so you may want to use road network whenever possible.
  • NVDB includes geometry for turn lanes. In OSM, however, turn lanes should be tagged as turn:lanes instead of as separate ways. The generated OSM files includes these extra ways, but without a highway tag, so that they may be manually conflated in JOSM. Some of these ways should be kept as separate ways in OSM whenever they are physically separated from the main road, typically for lanes turning to the right.
  • The generated ways currently are sometimes self-intersecting. Run simplify way with a factor of 0.2 in JOSM to fix it.
  • Road object ways currently have duplicate nodes at some intersections. Duplicates may be discovered and fixed automatically with the JOSM validator.
  • NVDB contains mistakes. You may report mistakes at Fiksvegdata. Rapid response.

Changelog

  • 1.6:
    • Support for bounding box in "-vegurl" also for road network (only WGS84).
    • Minor tagging adjustments (barrier, traffic lights, access restrictions).
  • 1.5:
    • Support NVDB data catalogue 2.34.
    • Make surface=asphalt default for motorway, trunk, primary and secondary roads + cycleways.
    • No explicit bicycle access on sidewalks and highway crossings.
    • Batch run may (re)start from given municipality number.
    • Data loading more resilient.
  • 1.4:
    • Support maxspeed:forward/backward and other objects with direction, e.g. surface, maxheight.
    • Support new objects 922, 923 and 924 - service roads, diversion roads and roads with proposed new classification.
    • Improve street names. Same code as for addr2osm.
    • Add ferry=* according to highway class.
    • Fix ref=* in Oslo/Bærum for "ring" roads.
  • 1.3:
    • Support ferry route names, emergency roads, avalanche protectors, deprecated highway references
    • Support upcoming extension of tracks and paths from FKB
    • Add "dato" function to discover new road segments since last month (saves all segment id´s each month)
    • Various updates in NVDB attributes (barriers, traffic regulations)
    • Various bug fixes and improvements for robustness
  • 1.2:
    • Simplify highway geometry, Ramer-Douglas-Peucker algorithm with factor 0.2.
    • Option to generate files in one go for all municipalities in Norway (type "Norge" instead of municipality name).
    • Highway=unclassified for private roads unless Sideveg=Ja in NVDB.
    • Support primart/secondary in Oslo (hack).
    • Keep short segments of private roads together, unless municipality road number exists in NVDB.
    • Date filter now checks NVDB start date (previously checked metering date).
    • Prettify XML output.
  • 1.1:
    • Highway output grouped by road reference number, which produces longer ways.
    • New optional command -date which only ouputs highways with coordinates from the given date(span)
  • 1.0:
    • Code converted to Python 3. NVDB api now supports tunnels and bridges for segments.

References

nvdb2osm's People

Contributors

comradekingu avatar ltglahn avatar nkamapper avatar noenandre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nvdb2osm's Issues

Konvertere flere key:tags for bomstasjoner

  • TAKST_LITEN_BIL = fee:car=*
  • TAKST_STOR_BIL = fee:hgv=*
  • BOMPENGEANLEGG_ID / BOMSTASJONSTYPE = barrier=toll_booth
  • NAVN_BOMPENGEANLEGG_(FRA_CS) = operator=*
  • ("BOMSTASJONSTYPE"="#13133 AutoPASS + automatisk") = type=AutoPASS
  • NAVN_BOMSTASJON = name=*
  • Hvis stasjonen har BOMPENGEANLEGG_ID så burde den være ref istedet for hva enn som blir ref nå. Det ser ut som ref til veien

Bomstasjonene får også en highway-tag på seg

nvdbswe2osm on AWS pipeline

Hi @NKAmapper

I just wanted to break out the discussion of running this script on my AWS pipline.
I wonder why you use the homogeniserad format. The problem I have with this is that this format doesn't seem to be automatically downloadable from Lastkajen Logistics. Or at least I have not found it...

Feil info om vegurl dersom nvdb2osm kjøres uten parameter

message('  nvdb2osm -url "<api url string>"  -->  Any api generated from vegkart.no (UTM bounding box not supported, wgs84 appended)\n\n')

skulle vært

message('  nvdb2osm -vegurl "<api url string>"  -->  Any api generated from vegkart.no (UTM bounding box not supported, wgs84 appended)\n\n')

Bedre plassering av highway=motorway_junction

Taggen highway=motorway_junction plasseres nå der Vegkryss (vegobjekt 37, planskilt kryss) er angitt i NVDB, dvs. på motorveien ca midt i kryssystemet. Den bør plasseres i noden der avkjøringen er. Noen steder er dette før nåværende plassering, andre ganger etter.

Sammenligning mellom elveg2osm og nvdb2osm

Sammenlignet det jeg fikk fra nvdb med python2 nvdb2osm.py -vn -k 1201 > 1201.osm og den nyeste ELVEGfilen som ligger tilgjengelig og endte med denne tabellen.

key nvdb2osm elveg2osm
amenity 0 3
barrier 0 213
bicycle 2232 0
bridge 375 327
cycleway 108 60
cycleway:left 14 0
cycleway:right 21 0
ferry 0 2
FIXME 67 171
foot 3623 3524
footway 54 2
highway 43749 21431
junction 956 0
lanes 838 401
lanes:backward 107 0
lanes:forward 107 0
lanes:psv 0 31
layer 804 667
maxheight 0 131
maxspeed 0 2629
maxspeed:backward 0 1
maxspeed:forward 0 1
motorcar 57 0
motorcar:lanes 21 0
motorcar:lanes:backward 25 0
motorcar:lanes:forward 38 0
name 0 19165
note 0 2
nvdb:date 0 10079
nvdb:id 0 10079
oneway 4480 2073
psv 57 22
psv:lanes 21 0
psv:lanes:backward 25 0
psv:lanes:forward 38 0
ref 7476 2684
route 3 0
route 0 2
tunnel 437 347
turn:lanes 2 0

Ser ut som nvdb2osm ikke har noen fartsgrenser eller navn, og det er en del ulikeheter (uten at jeg har noe formening om hva som er å foretrekke)

Ingen god støtte for "-vegurl" med API-url fra vegkart.no

Et kartutsnitt fra vegkart.no genererer API-kall mot vegnett/veglenkesekvener/segmentert, og har med seg kartutsnitt-parameter basert på størrelsen på nettleseren -- eksempel: https://nvdbapiles-v3.atlas.vegvesen.no/vegnett/veglenkesekvenser/segmentert?kartutsnitt=239655.6%2C6678316.987%2C241348.937%2C6679675.625

Å endre koordinatene for kartutsnittet til WGS84 fungerer dersom srid=4326 -- eksempel: https://nvdbapiles-v3.atlas.vegvesen.no/vegnett/veglenkesekvenser/segmentert?srid=4326&kartutsnitt=11.465859979493205,64.01792506981553,11.517636911427205,64.00000163044928

Men dette fungerer ikke med nvdb2osm, verken med srid satt eller ei. Dersom den ikke blir satt (siden den skal settes automatisk), begynner den å laste data før den feiler med HTTP 422:

nvdb2osm v1.5.0

Server:         https://nvdbapiles-v3.atlas.vegvesen.no/
API:            v2023.2.26, 2024-03-12
Data catalogue: v2.36, 2024-03-22
Last DB update: 2024-04-05

Ouput filename: nvdb_vegnett.osm

Loading NVDB data...
Done processing 1547 road objects/segments
Removing duplicate segments... Removed 2 segments
Merging object type #103 Fartsdemper...
Retry 1: HTTP Error 422: Unprocessable Entity
Retry 2: HTTP Error 422: Unprocessable Entity
´´´

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.