https://twitter.com/mdsumner/status/1543571104488636416
#install.packages("vapour")
#remotes::install_github("hypertidy/vaster")
| import duckdb | |
| import flask | |
| # Initialize Flask app | |
| app = flask.Flask(__name__) | |
| # Setup a global DuckDB connection with spatial extension loaded | |
| # Connect to a persistent database file with the geometry data | |
| config = {"allow_unsigned_extensions": "true"} | |
| con = duckdb.connect("tiles.db", True, config) |
| load spatial; | |
| -- point (adresse) | |
| -- Ex. 34+bis+avenue+philippe+solari | |
| -- Utilisation de la BAN | |
| create or replace table point as ( | |
| with a as (select unnest(features, recursive:=true) from read_json_auto(format('https://api-adresse.data.gouv.fr/search/?q={}', '34+bis+avenue+philippe+solari'))) | |
| select st_point(coordinates[1], coordinates[2]) as geom from a | |
| ); |
| <?php | |
| /* | |
| Template Name: Solutions JSON | |
| */ | |
| header( 'Content-Type: application/geo+json' . '; charset=' . get_option( 'blog_charset' ), true ); | |
| $more = 1; | |
| echo '{"type": "FeatureCollection", "features": ['; |
https://twitter.com/mdsumner/status/1543571104488636416
#install.packages("vapour")
#remotes::install_github("hypertidy/vaster")
| { | |
| "env": { | |
| "node": true, | |
| "es2021": true | |
| }, | |
| "extends": "eslint:recommended", | |
| "parserOptions": { | |
| "ecmaVersion": "latest", | |
| "sourceType": "module" | |
| }, |
| /** | |
| * RuntimeGlobalsChecker | |
| * | |
| * You can use this utility to quickly check what variables have been added (or | |
| * leaked) to the global window object at runtime (by JavaScript code). | |
| * By running this code, the globals checker itself is attached as a singleton | |
| * to the window object as "__runtimeGlobalsChecker__". | |
| * You can check the runtime globals programmatically at any time by invoking | |
| * "window.__runtimeGlobalsChecker__.getRuntimeGlobals()". | |
| * |
| /* Using a JavaScript proxy for a super low code REST client */ | |
| // via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg | |
| // also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3 | |
| // also see https://github.com/fastify/manifetch | |
| // also see https://github.com/flash-oss/allserver | |
| // and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
| const createApi = (url) => { | |
| return new Proxy({}, { | |
| get(target, key) { |
| import re | |
| import csv | |
| import ssl | |
| import urllib.request | |
| ssl._create_default_https_context = ssl._create_unverified_context | |
| baseUrl = 'https://geoservices.ign.fr/' | |
| url_page = baseUrl + 'documentation/services' |
| # aliases | |
| alias -g ll='ls -al' | |
| alias -g subl='open -a "Sublime Text"' | |
| alias server='python3 -m http.server 8000 --bind 127.0.0.1' | |
| alias rmvenv='deactivate && rm -rf venv/' | |
| alias venv='python3 -m venv venv' | |
| alias activate='source venv/bin/activate' | |
| alias pipupgrade='python3 -m pip install --upgrade pip' | |
| alias requirements='python3 -m pip install -r requirements.txt' |