Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / countries.geojson
Last active January 4, 2024 19:54
Sample Leaflet with GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Red Bull X-Alps 2019 Route</name>
<snippet>https://www.redbullxalps.com/ Created by twpayne@gmail.com</snippet>
<open>1</open>
<Folder>
<name>Route</name>
<Placemark>
<LineString>
@ThomasG77
ThomasG77 / standalone-qgis3.py
Last active November 16, 2023 01:00
QGIS 3 standalone application sample
# Code borrowed from https://subscription.packtpub.com/book/application_development/9781783984985/1/ch01lvl1sec18/creating-a-standalone-application
# and upgraded for QGIS 3.0
import os
import sys
import shutil
import tempfile
import urllib.request
from zipfile import ZipFile
from glob import glob
Date Time Latitude Longitude Depth Magnitude Quality Location
11.11.2023 07:28:10 63.808 -22.513 6.2 km 1.5 58.68 4.9 km SW of Grindavík
11.11.2023 07:27:27 63.827 -22.499 5.3 km 2.2 90.04 3.1 km WSW of Grindavík
11.11.2023 07:26:57 63.810 -22.515 6.1 km 1.5 90.02 4.8 km SW of Grindavík
11.11.2023 07:26:23 63.819 -22.508 6.5 km 1.9 90.05 3.9 km SW of Grindavík
11.11.2023 07:26:07 63.809 -22.516 6.9 km 1.1 90.01 4.9 km SW of Grindavík
11.11.2023 07:25:37 63.819 -22.504 5.6 km 2.1 90.04 3.7 km SW of Grindavík
11.11.2023 07:25:16 63.842 -22.484 5.5 km 2.2 90.07 2.1 km W of Grindavík
11.11.2023 07:24:45 63.267 -23.690 3.2 km 2.4 74.51 25.5 km SSE of Eldeyjarboði
11.11.2023 07:24:23 63.868 -22.636 1.1 km 0.6 77.86 8.3 km NNE of Reykjanestá
@ThomasG77
ThomasG77 / README.md
Last active November 10, 2023 08:52
Conversion id parcelle Etalab vers commune, prefixe, section, numero et inversement

Code pour passer des id de parcelles Etalab en commune, prefixe, section, numero et inversement

Par exemple, pour l'id de parcelle 323190000A0133

Il s'agit d'un clé composite (une clé constituée de plusieurs clés)

  • 5 premiers caractères = code INSEE sur 5 caractères soit 32319
  • 3 caractères suivants = prefixe, ancien code INSEE sur 3 caractères (on ne mentionne pas à nouveau le département). 000 si inchangé
  • 2 caractères suivants = lettre ou numéro de section préfixé de 0 si une seul caractère. Ainsi A deviens 0A
  • 4 derniers caractères = numéro de parcelle dans la section préfixé de 0 si nécessaire 133 devant 0133
@ThomasG77
ThomasG77 / README.md
Last active September 26, 2023 13:19
Generation EPT 2023 "one-shot"

Compiler un EPT (établissements publics territoriaux)/des EPT

Les établissements publics territoriaux (EPT) sont parmis les "EPCI sans fiscalité propre".

Source des données

@ThomasG77
ThomasG77 / fix_vrt.py
Last active September 14, 2023 00:16
Lien Adresse et parcelles
import xml.etree.ElementTree as ET
from optparse import OptionParser
parser = OptionParser()
(options, args) = parser.parse_args()
tree = ET.parse(args[0])
root = tree.getroot()
for child in root:
@ThomasG77
ThomasG77 / split-openvpn-file-for-gnome-manager-import.sh
Last active August 9, 2023 12:38
Convert single OpenVPN file to multiple to be compatible for import in Gnome VPN manager (improved from https://askubuntu.com/questions/134918/setting-vpn-client)
#!/usr/bin/env bash
# Improved and automated version of https://askubuntu.com/questions/134918/setting-vpn-client
# First arg = directory where you want to collect files
# Second arg = filename input
# To illustrate
# ./generate-cleaned-openvpn.sh my_test_directory labtop.ovpn
# After run, import with
# sudo nmcli connection import type openvpn file my_test_directory/client.ovpn
@ThomasG77
ThomasG77 / README.md
Last active July 27, 2023 00:17
Lister les fichiers INAO sur leur owncloud pour le Portail des plans officiels de délimitation