Skip to content

Instantly share code, notes, and snippets.

View HTenkanen's full-sized avatar

Henrikki Tenkanen HTenkanen

View GitHub Profile
@HTenkanen
HTenkanen / dr_to_graph.py
Last active July 7, 2023 06:24
Digiroad to Graph
import networkx as nx
from osgeo import ogr
import os
def load_graph_from_Digiroad_shape(filepath, direction='AJOSUUNTA', both_ways=2, against=3, along=4, strict=True):
"""Generates nx.MultiDiGraph() object from Digiroad 2.0 Shapefile.
Parameters
----------
@HTenkanen
HTenkanen / dr_to_graph.py
Created December 19, 2018 08:52
# Digiroad to Graph
import networkx as nx
from osgeo import ogr
import os
def load_graph_from_Digiroad_shape(filepath, direction='AJOSUUNTA', both_ways=2, against=3, along=4, strict=True):
"""Generates nx.MultiDiGraph() object from Digiroad 2.0 Shapefile.
Parameters
----------