Skip to content

Instantly share code, notes, and snippets.

View HTenkanen's full-sized avatar

Henrikki Tenkanen HTenkanen

View GitHub Profile
@HTenkanen
HTenkanen / GTFS_Helsinki.zip
Last active September 15, 2022 20:07
Transport data for accessibility analyses
This file has been truncated, but you can view the full file.
@HTenkanen
HTenkanen / README.md
Last active January 28, 2021 12:54
Helsinki_GTFSRT_dataset_2021

Helsinki Region GTFS-RT sample data

Dataset collected from GTFS-RT feed provided by Helsinki Region Transport. Used for educational purposes.

@HTenkanen
HTenkanen / concave_hull.md
Created January 20, 2021 12:53
Concave Hull with geopandas, scipy and numpy

Concave Hull in Python

A modified version for calculating concave hull (see source) based on GeoDataFrame of points

from scipy.spatial import Delaunay
import numpy as np
from shapely.ops import polygonize, cascaded_union
from shapely.geometry import MultiLineString
@HTenkanen
HTenkanen / Helsinki_region.osm.pbf
Last active October 16, 2021 11:38
OSM Protobuf data for Helsinki Region
This file has been truncated, but you can view the full file.
@HTenkanen
HTenkanen / README.md
Last active March 18, 2020 18:19
World Urban Areas

World Urban Areas

Boundaries of urban areas of the world combining data from different sources. The purpose of this dataset is to provide information about urban areas that helps to determine speed-limits for OpenStreetMap roads across the world in a more accurate manner.

Starting point for this layer is Urban Areas of the world by Stanford (2012) that uses the Oak Ridge National Laboratory's LandScan population database.

This data has been improved by replacing country specific data from:

import pandas as pd
import geopandas as gpd
from sqlalchemy import create_engine
from geoalchemy2 import Geometry
from shapely.geometry import MultiLineString, MultiPoint, MultiPolygon
from shapely.wkb import dumps
import io
from pyproj import CRS
import csv
import time
@HTenkanen
HTenkanen / README.md
Last active October 1, 2019 14:16
GTFS NOLA

Test GTFS data for New Orleans.

@HTenkanen
HTenkanen / ykr_basegrid.geojson
Last active June 27, 2019 10:01
YKR Basegrid for Helsinki Capital Region.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HTenkanen
HTenkanen / reachability_helsinki2018_test_data.csv
Created June 27, 2019 08:46
Test Helsinki Region Travel Time Matrix data for year 2018.
We can't make this file beautiful and searchable because it's too large.
from_id,to_id,walk_t,walk_d,bike_s_t,bike_f_t,bike_d,pt_r_tt,pt_r_t,pt_r_d,pt_m_tt,pt_m_t,pt_m_d,car_r_t,car_r_d,car_m_t,car_m_d,car_sl_d
5778014,5961891,-1,-1,124,78,30399,-1,-1,-1,-1,-1,-1,58,-1,51,-1,30
5778014,5963631,-1,-1,129,82,30081,-1,-1,-1,-1,-1,-1,54,-1,48,-1,30
5778014,5975375,-1,-1,127,80,31551,-1,-1,-1,-1,-1,-1,60,-1,54,-1,31
5778015,5961891,-1,-1,124,78,30399,-1,-1,-1,-1,-1,-1,58,-1,51,-1,30
5778015,5963631,-1,-1,129,82,30081,-1,-1,-1,-1,-1,-1,54,-1,48,-1,30
5778015,5975375,-1,-1,127,80,31551,-1,-1,-1,-1,-1,-1,60,-1,54,-1,31
5778016,5961891,-1,-1,135,85,32962,-1,-1,-1,-1,-1,-1,65,-1,56,-1,34
5778016,5963631,-1,-1,141,89,33191,-1,-1,-1,-1,-1,-1,60,-1,54,-1,34
5778016,5975375,-1,-1,139,88,34468,-1,-1,-1,-1,-1,-1,66,-1,59,-1,35
@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
----------