Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gratier ThomasG77

View GitHub Profile
View index.html
<html>
<head>
<title>Leaflet WMS</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
<script src="https://unpkg.com/leaflet.wms@0.2.0/dist/leaflet.wms.js"></script>
<style>
@ThomasG77
ThomasG77 / index.html
Created Jan 9, 2023
WMS maplibre tiled
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Add a WMS source untiled</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/@mapbox/sphericalmercator@1.1.0/sphericalmercator.js"></script>
@ThomasG77
ThomasG77 / index.html
Created Jan 9, 2023
WMS maplibre untiled
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Add a WMS source untiled</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/@mapbox/sphericalmercator@1.1.0/sphericalmercator.js"></script>
View index.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/leaflet.css" /> -->
<title></title>
<style>
html,
View gdal.log
GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
WFS: https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&REQUEST=GetCapabilities
HTTP: Fetch(https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&REQUEST=GetCapabilities)
WFS: No paging support
WFS: No ImplementsStandardJoins support
WFS: No transaction support
GDAL: GDALOpen(WFS:https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis, this=0x19342f0) succeeds as WFS.
GDAL: QuietDelete(cadastral_parcel_filtered.gpkg) invoking Delete()
@ThomasG77
ThomasG77 / ressources_demo_data_gouv_fr.sh
Created Nov 28, 2022
Get datasets/ressources from demo.data.gouv.fr
View ressources_demo_data_gouv_fr.sh
counter=0
while : ; do
counter=$((counter+1))
curl -s -X GET "https://demo.data.gouv.fr/api/1/datasets/?page=${counter}&page_size=500" >| "page_${counter}.json"
if [[ $( cat "page_${counter}.json" \
| jq '.next_page') == 'null' ]] ; then
break #Exit the loop
fi
done
@ThomasG77
ThomasG77 / debug_wms_capabilities_xml.py
Created Nov 24, 2022
Identify if issue with same name in XML WMS capabilities
View debug_wms_capabilities_xml.py
import argparse
from collections import Counter
import urllib.request
try:
from lxml import etree
except ImportError:
try:
print("Failed to import etree from lxml. Fall to default Python lib")
from xml.etree import ElementTree as etree
@ThomasG77
ThomasG77 / README.md
Last active Nov 23, 2022
Permalinks entre les applis carto métier
View README.md

"Permalinks all the things"

Pour basculer d'une appli à l'autre (carto généraliste) https://tankaru.github.io/OpenSwitchMapsWeb/index.html + extensions Firefox et Chrome https://github.com/tankaru/OpenSwitchMaps

La logique serait intéressante à appliquer à des applications existantes côté public. Le but: rajouter de la transversalité entre des domaines métier différents. Cela permettrait ensuite soit de faire comme les exemples généralistes (basculer d'une page à l'autre), soit de permettre à des applis de faire les "bonnes redirections" vers celle d'autres domaines métiers associés.

Exemples inventoriés

@ThomasG77
ThomasG77 / base-pop-historiques-1876-2019.csv
Last active Nov 22, 2022
Base historique population INSEE rapportée aux géographies 2022
View base-pop-historiques-1876-2019.csv
We can't make this file beautiful and searchable because it's too large.
CODE_2022,PMUN19,PMUN18,PMUN17,PMUN16,PMUN15,PMUN14,PMUN13,PMUN12,PMUN11,PMUN10,PMUN09,PMUN08,PMUN07,PMUN06,PSDC99,PSDC90,PSDC82,PSDC75,PSDC68,PSDC62,PTOT54,PTOT36,PTOT1931,PTOT1926,PTOT1921,PTOT1911,PTOT1906,PTOT1901,PTOT1896,PTOT1891,PTOT1886,PTOT1881,PTOT1876
01001,779,771,776,767,767,767,767,777,780,784,787,791,804,811,728,579,477,368,347,407,424,506,540,543,566,560,629,637,572,594,622,605,604
01002,256,253,248,243,241,239,236,235,234,221,207,194,195,198,168,159,136,106,88,103,157,203,219,253,256,291,323,357,391,421,486,490,484
01004,14134,14204,14035,14081,14127,14022,14359,14233,13839,13835,13350,12792,12696,12709,11436,10455,9737,9550,8949,7748,7159,6846,6794,5705,4796,4334,4100,4023,3548,3635,3618,3396,3427
01005,1751,1720,1689,1671,1619,1627,1635,1642,1600,1616,1592,1567,1544,1436,1408,1156,848,756,627,588,570,593,618,690,698,805,805,835,852,862,882,879,848
01006,112,112,111,110,109,109,108,110,112,116,120,123,125,120,86,76,65,82,108,107,111,141,135,161,150,159,193,200,206,200,200,213,191
View 5min_json_vers_geojson_avec_js.md

5 minutes pour passer du JSON vers du GeoJSON avec jq

Récupérez les données (URL fixe prise sur https://www.data.gouv.fr/fr/datasets/lieux-de-mediation-numerique-organisation-cartographie-nationale-des-lieux-de-mediation-numerique-2/)

curl -s https://static.data.gouv.fr/resources/lieux-de-mediation-numerique-organisation-cartographie-nationale-des-lieux-de-mediation-numerique-2/20221110-164433/20221110-hinaura-lieux-de-mediation-numeriques-auvergne-rhone-alpes.json

Prenez le JSON qui dispose déjà de coordonnées longitude, latitude et vous avez votre GeoJSON