Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / .gitignore
Created October 24, 2019 01:08
Import pour scrapper parcs et jardins de Nantes
node_modules/
package-lock.json
@ThomasG77
ThomasG77 / all_lines.csv
Created October 24, 2019 20:55
Demo récupération cityway API
We can't make this file beautiful and searchable because it's too large.
"Color","LineDirection","LineId","Shape"
,1,737,"MULTILINESTRING ((55.478232704103007 -21.335234597325147, 55.478249996900573 -21.335240006446671, 55.478569999337211 -21.334309995174237, 55.478790000081077 -21.333649992942643, 55.479039996862426 -21.332890003919438, 55.479120001196875 -21.332560002803628, 55.47899000346662 -21.332230001687833, 55.478919997811332 -21.332240000366998, 55.478869996964946 -21.332230001687829, 55.478710003197207 -21.332029998302293, 55.478749997913852 -21.331909999251195, 55.478849999606624 -21.331829994916752, 55.478919997811332 -21.331809997558423, 55.478739999234691 -21.331469997763467, 55.478720001876368 -21.331129997968507, 55.4788300022483 -21.330939993262124, 55.47950000315906 -21.330320000648328, 55.479939997196212 -21.329909995198079, 55.480271771550193 -21.329589039087129, 55.481320001184955 -21.32861000299437, 55.482199996709838 -21.327769994735554, 55.482390001416221 -21.32761999964697, 55.484439998865142 -21.326409995555714, 55.484949998557589 -21.32611000537856, 55.4
@ThomasG77
ThomasG77 / grease-monkey-google-url-back.js
Last active November 2, 2019 21:20
Greasemonkey script to restore URL view in Google search
// ==UserScript==
// @name Change URL back
// @version 1
// @include /(http|https):\/\/www\.google\.(ca|co\.in|co\.uk|com|com\.br|de|es|fr|it|pl|ru)\/search\?/
// @grant none
// ==/UserScript==
Array.from(document.querySelectorAll('cite')).forEach(el => el.textContent = el.parentElement.parentElement.href);
@ThomasG77
ThomasG77 / README.md
Created November 8, 2019 14:08
#30DayMapChallenge template
@ThomasG77
ThomasG77 / get-labelisation-france-service.sh
Last active December 30, 2019 20:47
Geocode Labelisation France Service
# Retrieve data
wget "https://www.cget.gouv.fr/sites/cget.gouv.fr/files/atoms/files/labellisations-france-services_01012020.pdf"
# Get number of pages in PDF
pages=$(pdfinfo labellisations-france-services_01012020.pdf | grep 'Pages' | awk '{print $2}')
# Scan PDF to get tables and write to csv
camelot --format csv --pages 1-$pages --output labellisations-france-services_01012020.csv lattice labellisations-france-services_01012020.pdf
# Empty/create some files
cp /dev/null labellisations-france-services.csv
cp /dev/null labellisations-france-services-cleaned.csv
cp /dev/null labellisations-france-services-format.csv
@ThomasG77
ThomasG77 / get-count-ogr.py
Created January 13, 2020 16:20
Get shp count from directory
# Try python3 get-count-ogr.py directory_with_shp
# Recursive
import argparse
import os
from osgeo import ogr
parser = argparse.ArgumentParser()
parser.add_argument("directory")
name: gdaltest
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=0_gnu
- backcall=0.1.0=py_0
- boost-cpp=1.70.0=h8e57a91_2
- boto3=1.11.7=py_0
<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"> <!-- end of DOCTYPE declaration -->
<WMT_MS_Capabilities version="1.1.1">
<!-- MapServer version 7.0.0 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<Service>
<Name>OGC:WMS</Name>
<Title>Données publiques de l&#39;ONF en Métropole</Title>
@ThomasG77
ThomasG77 / standalone-qgis3.py
Last active July 25, 2025 17:55
QGIS 3 standalone application sample
# Code borrowed from https://subscription.packtpub.com/book/application_development/9781783984985/1/ch01lvl1sec18/creating-a-standalone-application
# and upgraded for QGIS 3.0
import os
import sys
import shutil
import tempfile
import urllib.request
from zipfile import ZipFile
from glob import glob