Skip to content

Instantly share code, notes, and snippets.

View gijs's full-sized avatar

Gijs Nijholt gijs

View GitHub Profile
@gijs
gijs / gist:7673137
Created November 27, 2013 09:44 — forked from aflaxman/gist:287370
"""
Read graphs in Open Street Maps osm format
Based on osm.py from brianw's osmgeocode
http://github.com/brianw/osmgeocode, which is based on osm.py from
comes from Graphserver:
http://github.com/bmander/graphserver/tree/master and is copyright (c)
2007, Brandon Martin-Anderson under the BSD License
"""
@gijs
gijs / guide.md
Created November 14, 2013 15:21 — forked from tmcw/guide.md

Whole Earth Guide

I'm not sure about this; GIS really got burned from being both a 'science' and a 'product' from the beginning, and there are blurry lines between what I think is essential and what I don't know because I never do it and am not a GIS person. Anyway.

  • A No-Bullshit Intro to Maps and GIS
  1. What Maps Are
  2. Data
  3. Information
  4. Transformation

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@gijs
gijs / gist:6594358
Created September 17, 2013 13:36 — forked from signed0/gist:2031157
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
@gijs
gijs / import.sh
Created March 21, 2013 22:31 — forked from nvkelso/import.sh
#!/bin/bash
# loop through all of the shapefiles in the directory and act on them
# http://trac.osgeo.org/gdal/wiki/FAQVector#HowcanImergehundredsofShapefiles
# http://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
# !IMPORTANT: OGR 1.9 for direct to PostGIS support, linestring-multilinestring, and character encoding support.
if [ $# -ne 1 ]; then
echo "USAGE: ./import.sh <in_dir_path>"
# With the GeoJSON OGR driver one can use the CartoDB SQL API to create any OGR supported format output
# OGR Formats: http://gdal.org/ogr/ogr_formats.html
# CartoDB SQL API: http://developers.cartodb.com/documentation/sql-api.html
# This sample creates a DXF making a "select the_geom from meteo" from my account at CartoDB
ogr2ogr -skipfailures -f DXF out.dxf "http://xurxosanz.cartodb.com/api/v2/sql?q=select%20the_geom%20from%20meteo&format=GeoJSON" OGRGeoJSON
var express = require('express');
var oauth = require('oauth');
var app = express.createServer();
var key = "[api-key]";
var secret = "[api-secret]";
var request = new oauth.OAuth(null, null, key, secret, '1.0', null, 'HMAC-SHA1');
app.get('/api-request', function(req, res){
request.get(
"http://127.0.0.1:8000/api/1.0/data.json",