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
Created February 11, 2025 16:31
API jours fériés: passage sous forme de tableau

API jours fériés: passage sous forme de tableau

curl -s https://calendrier.api.gouv.fr/jours-feries/metropole.json | jq '[. | to_entries|sort_by(.key)| .[] | {"date":.key, "event": .value}]'
fetch('https://calendrier.api.gouv.fr/jours-feries/metropole.json').then(res => res.json()).then(json => {
    console.log(Object.entries(abc).map(([k,v]) => ({"date":k, "event": v})).toSorted((a, b) => a.date - b.date))
})
@ThomasG77
ThomasG77 / pnr.geojson
Created February 6, 2025 15:03
PNR demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ThomasG77
ThomasG77 / guf_pnr2013.geojson
Created February 6, 2025 12:46
PNR as GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.15.0/proj4.min.js" integrity="sha512-4cx6CH/aJi50kdbQ5dj6bDJM1WS0AOFBGgBfgSP2Ux2eK/5JhkL2pjUDIHwd8z6rfGuGr/aptDqs0EzbeRndvQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
proj4.defs("EPSG:2154","+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs");
function geometryPoint(entry, transformer) {
return transformer(entry)
}
@ThomasG77
ThomasG77 / leaflet-wmts-grayscale.html
Last active November 8, 2024 19:02
Leaflet styling source to black&white/grayscale on client side
<<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<style type="text/css">
#viewerDiv {
width:100%;
height:600px;
@ThomasG77
ThomasG77 / .gitignore
Last active October 21, 2024 17:29
"Poor man" head tail in QGIS
outside/
__pycache__
{
"title": "poissons",
"name": "poissons",
"fields": [
{
"name": "operation",
"type": "integer",
"constraints": {
"unique": true
}
@ThomasG77
ThomasG77 / recipe-fantoir-topo-2024.sh
Created September 30, 2024 13:06
Recette génération fantoir
git clone [email protected]:BaseAdresseNationale/fantoir.git
cd fantoir
yarn
# Data generated using https://github.com/landryb/topo2fantoir to convert Topo to fantoir
# Manual download of https://drive.opendata.craig.fr/s/opendata?path=%2Fadresse%2Ffantoir
# then concatenate after decompressing all gz files to fantoir.txt
cat fantoir.txt | yarn build
# Remarque ci-dessous obsolète: il reste des fichiers fantoir pour 2023 mais pas pour 2024 avec disparition fantoir au profit de Topo
@ThomasG77
ThomasG77 / gdal_wfs_download.py
Last active September 24, 2024 07:53
Download data from WFS using GDAL Python bindings
from osgeo import gdal
gdal.UseExceptions()
gdal.SetConfigOption('CPL_DEBUG', 'ON')
with gdal.config_options({
'OGR_WFS_PAGING_ALLOWED': 'ON',
'OGR_WFS_PAGE_SIZE': '250'
}):
ds = gdal.OpenEx('WFS:https://data.geopf.fr/wfs/wfs', gdal.OF_VECTOR)
print(ds)
@ThomasG77
ThomasG77 / README.md
Last active September 18, 2024 18:15
Génération GeoJSON Territoires d'industrie

Recipe to generate "Territoires d'industrie areas"

Data from https://www.data.gouv.fr/fr/datasets/programme-territoires-dindustrie/

wget https://static.data.gouv.fr/resources/programme-territoires-dindustrie/20240704-091848/liste-ti-com2023-20240704.csv # 2023-2027
wget https://static.data.gouv.fr/resources/programme-territoires-dindustrie/20230802-130420/liste-ti-com2023-20230802.csv # 2018-2023
wget https://files.opendatarchives.fr/professionnels.ign.fr/adminexpress/ADMIN-EXPRESS-COG_3-2__SHP_WGS84G_FRA_2023-05-03.7z
7z e ADMIN-EXPRESS-COG_3-2__SHP_WGS84G_FRA_2023-05-03.7z COMMUNE.* -r -aoa