Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gratier ThomasG77

View GitHub Profile
View jsv2 polygons to geojson
// 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])
}
feature.properties = {hint:o.hint, html: o.infohtml}
return feature;
}
var results={type: "FeatureCollection", features: []};
@om-henners
om-henners / iPython_svg_example.ipynb
Last active August 29, 2015 13:58
iPython shapely geometry representation example
View iPython_svg_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View shapely_benchmarks.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dwtkns
dwtkns / l8_pansharp.sh
Created July 30, 2014 18:26
l8_pansharp
View l8_pansharp.sh
# 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.
View clock.sql
-- 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
select
m as id
, case when m % 5 = 0 then 'h' else 'm' end as typ
, m % 5 as h
@wboykinm
wboykinm / dumpasgeojson.sh
Last active August 29, 2015 14:16
How to dump geojson from postgres without ogr2ogr
View dumpasgeojson.sh
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'"
View gist:3c901b4652624c159b2d
const fun = ({param1 = 'some default value', param2 = 'other default value'} = {}) => {
console.log(param1);
console.log(param2);
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
NicoPennec / 45-tools-to-boost-your-front-end.md
Last active August 29, 2015 14:23
"45 Tools to Boost Your Front-End" (BreizhCamp 2015)
View pallabeling_api.py
# -*- 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
sgillies / with-descartes-reduce.py
Created March 11, 2012 06:17
Mapping and reducing
View with-descartes-reduce.py
# 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