Skip to content

Instantly share code, notes, and snippets.

# bash script to install GDAL 2.0.1 with Python on Ubuntu 14.04 (works on Scaleway ARM architecture)
apt-get unzip install g++ byacc flex libjpeg-dev zlib1g-dev build-essential libhdf4-dev libhdf5-dev hdf5-tools libproj-dev python-numpy python-pip python-setuptools python-dev -y
pip install numpy
apt-get install python3-numpy python3-pip python-setuptools python3-dev -y
pip3 install numpy --upgrade
mkdir /opt/gdal
cd /opt/gdal
@meule
meule / degress2meters.js
Last active September 13, 2015 06:39 — forked from springmeyer/degress2meters.js
convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
x= -77.035974
y = 38.898717
@meule
meule / geocode.py
Created August 28, 2015 13:39
Simple csv geocoder
# -*- coding: utf-8 -*-
# python geocoder. adds lat and lng columns to any csv file with geo reference
#
# usage:
# python geocode.py data_table.csv output_table.csv <list of geocolumns
# example:
# python geocode.py ib_interactive_map_database_v6.csv ngo_data_6.csv georef,country
import urllib2
@meule
meule / gist:777d9a8a42e2c99a3386
Created April 18, 2015 09:26
Smooth animation of changing Leaflet marker's position on setLatLng
// just include d3js and add animaDur in ms to marker's option
L.SVG.prototype._setPath = function(layer,path){
if(layer.options.animaDur)
d3.select(layer._path).transition().duration(layer.options.animaDur).ease('linear').attr('d',path)
else
layer._path.setAttribute('d', path);
}
@meule
meule / d3shortcuts.js
Created February 27, 2015 11:17
d3js style selection shortcuts
/* d3js style selection shortcuts by Konstantin@Varik.ru */
(function(){
d3.selection.prototype.opacity =
d3.selection.enter.prototype.opacity =
d3.transition.prototype.opacity =
function(opacity){
if (typeof opacity == 'number')
return this.style('opacity', opacity)
@meule
meule / README.md
Last active August 29, 2015 14:06 — forked from jimkang/README.md

This example, using satirical data from The Onion, demonstrates how to wrap long axis labels to fit on multiple lines.

Update (jimkang): Added a data accessor function as a parameter to mbostock's wrap() so that it can fetch the text from the data source rather than using text().

The problem with text() is that it is built on textContent which "returns the text content of this node and its descendants." If a text element has several tspan descendants, it joins their contents without spaces. e.g. a text element with three tspans each containing 'why', 'are', and 'we' will give back 'whyarewe' through text(). The rest of wrap will proceed to treat that as one word, naturally.

This becomes an issue when wrap() is called multiple times on text elements that have already been processed by wrap().

@meule
meule / map.geojson
Created August 20, 2013 21:40
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.