Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / maptam-22-metropoles.csv
Created May 23, 2023 12:46
GeoJSON maptam 22 metropoles avec communes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
commune_principale_maptam;code_siren
Bordeaux;243300316
Brest;242900314
Clermont;246300701
Dijon;242100410
Grenoble;200040715
Lille;200093201
Metz;200039865
Montpellier;243400017
Nancy;245400676
import json
profiler = QgsApplication.profiler()
tree = []
for row in range(0, profiler.rowCount()):
line = []
for col in range(0, profiler.columnCount()):
index = profiler.index(row, col)
line.append(profiler.data(index))
if len(line) == 2:

Issue related to releases files from announcement https://blog.geofabrik.de/?p=589

The recipe

sudo update
sudo apt-get -q install -y build-essential git wget unzip tmux htop aria2 sysstat brotli cmake ifstat libsqlite3-dev openssl libssl-dev pkg-config curl gnupg2 ca-certificates lsb-release nginx

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
@ThomasG77
ThomasG77 / list_postgresql_instance_tables.sh
Created March 26, 2023 14:20
List schema and tables from all databases in PostgreSQL cluster
psql -t --csv -d postgres -c "WITH get_database_names AS (
SELECT d.datname as dbname
FROM pg_catalog.pg_database d
WHERE d.datname <> 'template0'
ORDER BY 1
)
SELECT * FROM get_database_names;" >| databases.txt
echo "schemaname,tablename,dbname" >| all_tables.txt
for i in $(cat databases.txt);
const zlib = require('zlib');
const unzip = zlib.createUnzip();
const fs = require('fs');
var geojsonStream = require('geojson-stream');
function mergeFeatureCollectionStream (inputs) {
var out = geojsonStream.stringify();
inputs.map(async (file) => {
fs.createReadStream(file)
@ThomasG77
ThomasG77 / App.java
Created February 10, 2023 14:11
Java certificate issues recipe + basic java demo
package com.demo.HttpClientDemo;
// Package Jar issue de https://github.com/stleary/JSON-java
import org.json.JSONArray;
import org.json.JSONObject;
import java.net.URI;
import java.net.http.HttpClient; // < New in Java 11, can also handle HTTP/2 requests!
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@ThomasG77
ThomasG77 / App.java
Created February 8, 2023 17:56
Java basic http client API Geo (Java 11+)
package com.demo.HttpClientDemo;
// Package Jar issue de https://github.com/stleary/JSON-java
import org.json.JSONArray;
import org.json.JSONObject;
import java.net.URI;
import java.net.http.HttpClient; // < New in Java 11, can also handle HTTP/2 requests!
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@ThomasG77
ThomasG77 / index.html
Last active January 9, 2023 13:40
WMS Leaflet
<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 January 9, 2023 13:37
WMS maplibre tiled
<!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 January 9, 2023 13:36
WMS maplibre untiled
<!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>