Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / README.md
Last active July 9, 2024 11:50
Generation diagramme image pour Photoshop
@ThomasG77
ThomasG77 / README.md
Last active July 6, 2024 19:38
Bureaux de vote des circonscriptions de l'étranger

Récupération des bureaux de vote des circonscriptions de l'étranger

wget https://www.resultats-elections.interieur.gouv.fr/telechargements/LG2024/territoires/territoires.xml
echo '"code_com","lib_com","code_circ","lib_circ"' >| circo_etrangers_zz.csv
xq -r -c '."Election"."EnsembleGeo"."Regions"."Region"[] | select(."CodReg" == "00") | ."Departements"."Departement"[] | select(."CodDpt" == "ZZ") | ."Circonscriptions"."Circonscription"[] | ."CodCirElec" as $codeCir | ."LibCirElec" as $libCirElec | ."Communes"."Commune"[] | [."CodCom", ."LibCom", $codeCir, $libCirElec] | @csv' territoires.xml >> circo_etrangers_zz.csv

CSV et SHP géocodés avec QGIS en utilisant le plugin MMQGIS. Voir le shp dans le zip, le GeoJSON dans dans le dépôt

@ThomasG77
ThomasG77 / README.md
Created May 22, 2024 12:21
Generate vector tiles for Planet with tilemaker

Generate vector tiles for Planet with tilemaker

Recipe

# You need a recent curl version. Hence, my path points to a compiler curl version
# The goal is to manage when new MAJ should be done instead of running full processing for nothing
curl_path=/home/thomasg/curl/bin/curl
mydate=$($curl_path -Ls -o /dev/null --head -w "%header{last-modified}" https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf)
current_date=$(date -d "$mydate" +"%Y-%m-%dT%H:%M:%S%:z")
@ThomasG77
ThomasG77 / csw-consume-observatoire-territoires.py
Created May 3, 2024 12:43
Consommation CSW Observatoire des territoires
from owslib.csw import CatalogueServiceWeb
url_csw = 'https://www.observatoire-des-territoires.gouv.fr/outils/cartographie-interactive/services/csw/'
csw = CatalogueServiceWeb(url_csw)
infos = []
csw.getrecords2(startposition=0, maxrecords=20)
for rec in csw.records:
result = [csw.records[rec].title, csw.records[rec].identifier]
@ThomasG77
ThomasG77 / README.md
Last active April 20, 2024 16:12
Pompage dump données Geoportail de l'urbanisme

Copie données WFS depuis le géoportail de l'urbanisme

Ici on prend les données GPKG mais shp et CSV aussi disponibles selon vos préférences

# Infos pompées de https://www.geoportail-urbanisme.gouv.fr/image/Manuel_export_massif.pdf
# Obtenu via discussion https://georezo.net/forum/viewtopic.php?pid=367182#p367182
# Do once (to get ssh key)
timeout 5 ssh -oStrictHostKeyChecking=accept-new -p 2200 gpu_depot_exports@sftp-public.ign.fr
# List files
<!DOCTYPE html>
<html>
<head>
<!--
Copyright (c) 2015-2020 Jean-Marc VIGLINO,
released under CeCILL-B (french BSD like) licence: http://www.cecill.info/
-->
<title>ol-ext: WMS Capabilities control</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ThomasG77
ThomasG77 / README.md
Created April 14, 2024 21:47
Compile Node - quick recipe

Compile Node

sudo mkdir -p /opt/node/bin
chmod -R 777 /opt/node/
cd ~
git clone --depth 1 --branch v20.9.0 https://github.com/nodejs/node
cd node
sudo apt-get install build-essential python3-distutils git
sudo apt install clang-10
@ThomasG77
ThomasG77 / README.md
Created April 8, 2024 11:17
Generate daily stations from meteo france data

Récupération des stations quotidiennes depuis les données Météo France

import json
import urllib.request
from glob import glob
import pandas as pd
import geopandas
@ThomasG77
ThomasG77 / README.md
Last active April 9, 2024 17:36
Fichiers IGN à disposition via la Géoplateforme
@ThomasG77
ThomasG77 / README.md
Created April 5, 2024 17:20
IGN 7z vs zip with some parquet experiments

7z vs zip avec données IGN

Nous avons compressé le fichier 7z

wget https://data.geopf.fr/telechargement/download/ADMIN-EXPRESS-COG/ADMIN-EXPRESS-COG_3-1__SHP_WGS84G_FRA_2023-05-03/ADMIN-EXPRESS-COG_3-1__SHP_WGS84G_FRA_2023-05-03.7z
7z x ADMIN-EXPRESS-COG_3-1__SHP_WGS84G_FRA_2023-05-03.7z
zip -r ADMIN-EXPRESS-COG_3-1__SHP_WGS84G_FRA_2023-05-03.zip ADMIN-EXPRESS-COG_3-1__SHP_WGS84G_FRA_2023-05-03