Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / .eslintrc.json
Last active April 18, 2022 23:24
Play with gdal.vectorTranslate in Node.js
{
"env": {
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
@ThomasG77
ThomasG77 / .gitignore
Last active March 17, 2022 22:01
Use https certificate on localhost with Express
node_modules/
declare -a depts=(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 2A 2B 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 971 972 973 974 976)
true >| stats_api_pro_bio.txt
for i in "${depts[@]}"
do
url="https://back.agencebio.org/api/gouv/operateurs/?departements=$i";
tot=$(curl -X 'GET' "$url" -H 'accept: application/json' | jq -r '.nbTotal');
echo "${i};${tot}" >> stats_api_pro_bio.txt;
done
@ThomasG77
ThomasG77 / index.html
Created March 15, 2022 21:41
Demo plotly
<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-2.9.0.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
<script src="script.js"></script>
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
id;longitude;latitude;famille_arbre;genre_arbre;espece_arbre;cultivar_variete_arbre;nom_vernaculaire;code_insee;code_postal;adresse;matricule_arbre;date_plantation;hauteur;diametre;type_sol;type_enracinement;port_arbre;arbre_remarquable;arbre_protege;contraintes_sol;contrainte_aeriennes;eclairage;arrosage;allergie;remarque
1;49.802;0.3768;Sapindaceae;Acer;campestre;;Erable champetre;13028;13600;320 Avenue Joseph Roumanille;259001;2018-05-12;100;58;Argilo-sableux;Oblique;Boule;Non;Non;Sol perméabilisé;Cables éléctriques;Oui;Goutte à goutte;3;
2;43.2959;5.3761;Rosaceae;Pyrus;calleryana;chanticleerc;"Poirier ""chanticleerc""";13055;13001;60 rue sainte;1998PyrCal130011150;1998-04-20;235;73;Argileux;Pivotant;;Non;Non;Grille abimée;proximité d'un mur;Non;;;tronc abimé lors de travaux
3;43.2915;5.4805;Platanaceae;Platanus;occidentalis;;Platane d'Amérique;13055;13002;72 Boulevard des Dames;;1990-03-01;;;;;;Non;Non;;;Oui;;2;dans un alignement
4;44.2920;5.3705;Pinaceae;Pinus;sylvestris;;Pin sylvestre;13055;13013;48 ru
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
wget "https://macarte.ign.fr/carte/322ea69dab4c7e5afabc6ec7043b5994/acquisitionslidarhd"
cat acquisitionslidarhd | grep " symfony.data = "| sed 's# symfony.data = ##g' >| out.json
jq -c '.layers[2].features[] | {"type": "Feature", "geometry": {"type": .type, "coordinates": .coords}, "properties": .attributes}' out.json | jq --slurp '{"type": "FeatureCollection", "features": .}' >| out.geojson
ogr2ogr -f GeoJSON -s_srs "EPSG:3857" -t_srs "EPSG:4326" lidar_hd_overall.geojson out.geojson -lco RFC7946=YES
@ThomasG77
ThomasG77 / README.md
Last active March 8, 2022 16:16
Consommation à distance du Geopackage BDTOPO France entière Sept 2021 - 83Go

GDAL VSICURL tests to remote BDTOPO Geopackage France

# MultiPolygon output
ogr2ogr -f GeoJSON /tmp/mairies_multipolygons.geojson "/vsicurl/https://labs.webgeodatavore.com/partage/bdtopo.gpkg" \
        -lco RFC7946=YES \
        -sql "SELECT code_insee, nom_officiel, liens_vers_autorite_administrative, zone_d_activite_ou_d_interet.* FROM commune LEFT JOIN zone_d_activite_ou_d_interet ON liens_vers_autorite_administrative = zone_d_activite_ou_d_interet.cleabs"

# Point output
ogr2ogr -f GeoJSON /tmp/mairies_points.geojson "/vsicurl/https://labs.webgeodatavore.com/partage/bdtopo.gpkg" \
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.