This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Fetching a bunch of objects of a specifid type from Norwegian National | |
road database (NVDB). See https://www.vegvesen.no/nvdb/apidokumentasjon/ | |
Here, we set up a geographic filter for a certain road number (fv30) and county (16), | |
and a property filter (skiltnummer = Fartsgrense 70 km/t). | |
""" | |
import requests | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Check alignment of NVDB road network and metering system (vegreferanse) | |
in a particular point at the road network, specified as road | |
link ID and (non-dimmensional) linear reference position. | |
Usage: | |
(roadDir, meterDir) = nvdbdirection( 971429, 0.2) # Input: NVDB Road linkID | |
# and position | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trenger disse funksjonene: https://github.com/LtGlahn/nvdbapi-V2/blob/master/nvdbapi.py | |
# | |
from nvdbapi import * | |
# Tom liste som holder navn på kontraktsområdene vi finner | |
kontraktsomr = [] | |
# Henter et heldekkende objekt fra NVDB | |
vegref = nvdbFagdata( 532) | |
vegref.addfilter_geo( { 'kommune' : '1601', 'vegreferanse' : [ 'E', 'R', 'F', 'K' ] }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Finn lengde av grusveger (vegdekke med massetype = grusveg) | |
Supplerer rapportgenerator http://labs.vegdata.no/nvdb-rapporter/ | |
som går mot V1 av NVDB api, og derfor ikke klipper lengder på kommunegrenser | |
ref http://api.vegdata.no/endepunkt/vegobjekter.html | |
""" | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Created on Thu May 31 10:41:18 2018 | |
Henter trafikkulykker etter 2012 med datterobjekt 571 av typen sykkel, og | |
lagrer som geojson med lat/lon koordinat (srid=4326) | |
""" | |
import nvdbapi | |
import nvdb2geojson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Finner ulykker i tunneller ut fra kjent tunnelID. | |
Forutsetter at dette biblioteket er i søkestien (evt i samme mappe): | |
https://github.com/LtGlahn/nvdbapi-V2 | |
Metodikk: For alle tunnell-Id'er | |
* Hent alle relasjoner tunnell->tunnelløp | |
* For alle tunnelløp: | |
* hent veglenkeposisjoner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import datetime | |
# Konfigurering | |
outputfile = 'paginering45.json' | |
url_tomside = 'http://jansimple.pythonanywhere.com/static/tompaginering.json' | |
minimumantall = 300 # Dropper skriving hvis vi ikke får flere objekter enn som så | |
# Interne variabler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Konseptutvikling / demonstrasjon av hvordan du finner vegobjekt med framtidig startdato i NVDB | |
Eksemplet leter etter tunneler (587) som har startdato > dagen i dag. | |
Per 19. august vet vi om ett objekt med startdato = 10. september 2020. | |
(https://nvdbapiles-v3.atlas.vegvesen.no/vegobjekter/581/1008940122/1) | |
Vi har funnet to metoder som begge virker: | |
- Metode 1: Hente alle versjoner (alle start/sluttdatoer) for en objekttype | |
- Metode 2: Hent alle forekomster som antas å være gyldig en gang langt inn i framtida |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Analyserer hvilke europa, riks og fylkesveger som ble til kommunalveger nyttår 2010 i Oslo | |
Forutsetter at du har geopandas og dette biblioteket tilgjengelig https://github.com/LtGlahn/nvdbapi-V3 | |
""" | |
import sqlite3 | |
import geopandas as gpd | |
import pandas as pd |
OlderNewer