Skip to content

Instantly share code, notes, and snippets.

Thomas Gratier ThomasG77

Block or report user

Report or block ThomasG77

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ThomasG77
ThomasG77 / .gitignore
Last active May 4, 2019
Use GDAL2Tiles to view images in Leaflet
View .gitignore
btv1b53095142n_f1.jpg
tiled/
@ThomasG77
ThomasG77 / index.html
Created May 4, 2019
Leaflet.Spin standalone (similar to official https://github.com/makinacorpus/Leaflet.Spin but use only CDNs)
View index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Leaflet.Spin</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.Spin/1.1.0/leaflet.spin.min.js" charset="utf-8"></script>
<style type='text/css'>
@ThomasG77
ThomasG77 / geojson_to_h3_hexagons.py
Created Apr 28, 2019
Take a GeoJSON as an input, take all H3 hexagons within and output GeoJSON hexagons with their id
View geojson_to_h3_hexagons.py
from h3 import h3
geoJson = {'type': 'Polygon',
'coordinates': [[[37.813318999983238, -122.4089866999972145],
[ 37.7866302000007224, -122.3805436999997056 ],
[37.7198061999978478, -122.3544736999993603],
[ 37.7076131999975672, -122.5123436999983966 ],
[37.7835871999971715, -122.5247187000021967],
[37.8151571999998453, -122.4798767000009008]]] }
@ThomasG77
ThomasG77 / .gitignore
Last active Apr 28, 2019
Generate H3 hexagons
View .gitignore
node_modules/
package-lock.json
*.geojson
*.gpkg
View standalone-qgis3.py
# Code borrowed from https://subscription.packtpub.com/book/application_development/9781783984985/1/ch01lvl1sec18/creating-a-standalone-application
# and upgraded for QGIS 3.0
import sys
from qgis.core import (QgsApplication, QgsFeature, QgsGeometry,
QgsProject, QgsVectorLayer)
from qgis.gui import QgsMapCanvas
from qgis.PyQt.QtCore import Qt
# Unused so commented
# from qgis.PyQt.QtGui import *
@ThomasG77
ThomasG77 / demo_reproject_to_epsg4326.sh
Created Dec 6, 2018
Démo pour montrer comment reprojeter en EPSG 2154 un CSV issu du géocodage de l'API CSV de http://adresse.data.gouv.fr/
View demo_reproject_to_epsg4326.sh
## How to reproject to EPSG 2154
# Get data
cd /tmp/
wget http://www.douane.gouv.fr/Portals/0/fichiers/datadouane/geolocalisation/annuaire-des-debits-de-tabac-2018.zip
# Uncompress
unp annuaire-des-debits-de-tabac-2018.zip
# Take only 10 first lines
View index.html
<!doctype html>
<!--
This can be used to test the tile serving.
In a browser, open this as a local file.
You will have to start the app server instance without the host option, so that it
will serve as "localhost".
-->
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
@ThomasG77
ThomasG77 / promise-race.js
Created Aug 28, 2018
Promise.race illustrated with sourceforge mirrors
View promise-race.js
const fetch = require('node-fetch');
const mirrors = ['astuteinternet', 'ayera', 'cfhcable', 'cytranet', 'datapacket', 'excellmedia', 'freefr', 'gigenet', 'iweb', 'jaist', 'kent', 'liquidtelecom', 'managedway', 'nchc', 'netcologne', 'netix', 'newcontinuum', 'phoenixnap', 'pilotfiber', 'razaoinfo', 'superb-dca2', 'superb-sea2', 'svwh', 'tenet', 'ufpr', 'versaweb'];
const url = 'https://sourceforge.net/projects/filezilla/files/FileZilla_Client/3.31.0/FileZilla_3.31.0_win64-setup.exe/download';
// Find the fastest Sourceforge mirror manually
// The usual use case would for Promise.race would be
// when calling images from multiple servers
// (imagine different AWS S3 storage) to get the fastest one
var p = Promise.race(
@ThomasG77
ThomasG77 / README.md
Last active Jul 24, 2018 — forked from rveciana/README.md
Using JSTS to measure how far a line travels through a polygon
View README.md

Example to ilustrate this question at gis.stackoverflow.

We choose to replace Turf with JSTS.

If the result is more complex (i.e. the resulting intersection is a polyline), the algorithm should be repeated for each part in the polygon.

@ThomasG77
ThomasG77 / README.md
Created Jul 12, 2018 — forked from tmcw/README.md
Line Chart
View README.md
You can’t perform that action at this time.