Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Verney Phyks

View GitHub Profile
View trekking.brf
# *** The trekking profile is for slow travel
# *** and avoiding car traffic, but still with
# *** a focus on approaching your destination
# *** efficiently.
---context:global # following code refers to global config
# Bike profile
assign validForBikes = true
@Phyks
Phyks / analysis.txt
Created Jun 25, 2019
openstreetmap-carto analysis
View analysis.txt
+----------------------------------------+------------+
| Style name | # of rules |
+----------------------------------------+------------+
| text-point | 1528 |
| roads-fill-fill | 802 |
| tunnels-fill | 794 |
| bridges-fill | 754 |
| amenity-points | 546 |
| landcover-high-zoom | 467 |
| landcover-upper-mid-zoom | 206 |
View generate_roads.py
#!/usr/bin/env python
import yaml
CYCLEWAYS_OUTLINES = [
'lane',
'opposite_lane',
'track',
'opposite_track',
'share_busway',
'opposite_share_busway',
@Phyks
Phyks / App.java
Created Nov 20, 2018
Fast distance computation for BRouter
View App.java
class App {
public static void main(String [ ] args)
{
int N_TESTS = 10000000;
double R = 6371000.;
double rad = Math.PI / 180;
double[] latlng1 = {48.8124, 2.3158};
double[] latlng2 = {48.8204, 2.3210};
@Phyks
Phyks / output.txt
Last active Nov 11, 2018
Try to find postal codes without boundaries in OSM.
View output.txt
["01170", "01290", "01410", "01750", "06000", "06100", "06130", "06150", "06160", "06200", "06300", "06400", "06520", "06600",
"07160", "07190", "07310", "07320", "07510", "07630", "12140", "12350", "12460", "13090", "13100", "20000", "20090", "20200",
"20220", "20251", "20256", "20270", "20600", "26340", "26470", "30000", "30900", "33950", "33970", "34000", "34070", "34080",
"34090", "35000", "35200", "35700", "37000", "37100", "37200", "38000", "39120", "39330", "39600", "39800", "42000", "42100",
"44000", "44100", "44200", "44300", "45000", "45100", "46630", "49000", "49100", "50100", "50130", "57000", "57050", "57070",
"59000", "59260", "59491", "59493", "59650", "59777", "59800", "60113", "60190", "63000", "63100", "65200", "65710", "66000",
"66100", "67000", "67100", "67130", "67200", "67570", "68126", "68630", "75000", "76450", "76540", "76600", "76610", "76620",
"83000", "83100", "83200", "83370", "83530", "83600", "83700", "84000", "84140", "87000", "87100", "87280", "92190", "92360"]
@Phyks
Phyks / trekking-custom.brf
Created Nov 7, 2018
BRouter custom trekking profile
View trekking-custom.brf
# *** The trekking profile is for slow travel
# *** and avoiding car traffic, but still with
# *** a focus on approaching your destination
# *** efficiently.
#
# TODO: https://github.com/abrensch/brouter/issues/98
---context:global # following code refers to global config
@Phyks
Phyks / date.js
Created Aug 29, 2018
Relative date and date formatting in JS, minimal replacement for date-fns or Moment
View date.js
import i18n from '@/i18n';
/*
* Code below is dapted from
* https://github.com/date-fns/date-fns/blob/v1/src/format/index.js
* Licensed under MIT © Sasha Koss.
*/
export function addLeadingZeros(number, targetLength) {
let output = Math.abs(number).toString();
while (output.length < targetLength) {
View basic
DROP TABLE IF EXISTS z30;
-- Get all zone:maxspeed ways, with geometry in Lambert93
CREATE TEMP TABLE z30 AS
SELECT
id,
tags,
ST_Transform(linestring, 2154) AS linestring
FROM
ways
WHERE
@Phyks
Phyks / main.py
Created Jul 23, 2018
Accidents vélos à Montrouge
View main.py
# Load from https://opendata.hauts-de-seine.fr/explore/dataset/accidents-corporels-de-la-circulation-routiere/information/?disjunctive.cat_route1&sort=-date&location=18,48.81793,2.3158&basemap=jawg.streets
import json
import folium
import pandas
data = pandas.read_csv('accidents-corporels-de-la-circulation-routiere.csv', delimiter=';', parse_dates=['DATE'])
map = folium.Map(location=[48.816, 2.321], zoom_start=15,
tiles='https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png', attr='toto')
@Phyks
Phyks / floquet.py
Created May 29, 2018
Qutip Floquet code
View floquet.py
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,