Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
// gmaps js api v2 polygon overlays -> geojson
overlayToGeoJSON = function(o){
var feature={type:'Feature', geometry:{ type:'Polygon', coordinates:[[]]}};
for (var i=0; i < o.latlngs.length; i++){
feature.geometry.coordinates[0].push([o.latlngs[i].lng + o.reflng, o.latlngs[i].lat + o.reflat])
} = {hint:o.hint, html: o.infohtml}
return feature;
var results={type: "FeatureCollection", features: []};
om-henners / iPython_svg_example.ipynb
Last active August 29, 2015 13:58
iPython shapely geometry representation example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dwtkns /
Created July 30, 2014 18:26
# These are shell functions to quickly create pansharpened RGB images ready for color correction
# from a set of raw Landsat 8 TIF files in a given directory.
# For example:
# l8_pansharp LC81690352014169LGN00
# Creates:
# LC81690352014169LGN00_rgb_pansharp.tif
# l8_rush_pansharp downloads a L8 tile from Google Storage (if they have it), extracts the relevant bands, then creates the pansharpened output.
-- Open These views with QGIS
-- You can label the ticks view with this expression : "CASE WHEN m % 5 = 0 THEN h END" to get hour numbers
-- Set categorized styles on typ and unit to set different styles for dials, and for the hands
-- Please tweet your best clock designs with #PostGISClock hashtag
create or replace view ticks as
m as id
, case when m % 5 = 0 then 'h' else 'm' end as typ
, m % 5 as h
wboykinm /
Last active August 29, 2015 14:16
How to dump geojson from postgres without ogr2ogr
psql DBNAME -c "\\copy (SELECT ST_AsGeoJson(ST_Union(the_geom)) AS the_geom, attribute2, attribute3 FROM TABLENAME) to '/PATH/TO/YOUR/DESIRED/FILE.geojson'"
const fun = ({param1 = 'some default value', param2 = 'other default value'} = {}) => {
console.log(options); // Can I somehow get access to the object that has param1 and param2 inside?
console.log(arguments[0]); // Is this the only way?
NicoPennec /
Last active August 29, 2015 14:23
"45 Tools to Boost Your Front-End" (BreizhCamp 2015)
# -*- coding: utf-8 -*-
"""QGIS QgsPalLabeling examples
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
__author__ = 'Larry Shaffer'
__date__ = '10/14/2013'
sgillies /
Created March 11, 2012 06:17
Mapping and reducing
# Making maps with reduce()
from matplotlib import pyplot
from descartes import PolygonPatch
from fiona import collection
BLUE = '#6699cc'
def render(axes, rec):
"""Given matplotlib axes and a record, adds the record as a patch