Skip to content

Instantly share code, notes, and snippets.

View gijs's full-sized avatar

Gijs Nijholt gijs

View GitHub Profile
@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.

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@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
@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
"""
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<div class="viewport"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r58/three.min.js"></script>
<script src="//threejs.org/examples/js/controls/OrbitControls.js"></script>
def WorldFileParameters(self, tx, ty, zoom):
"Returns world file (affine transofrmation) parameters of the given tile"
bounds = self.TileBounds( tx, ty, zoom)
moriginx = bounds[1] + (self.Resolution(zoom) / 2)
moriginy = bounds[2] - (self.Resolution(zoom) / 2)
return (self.Resolution(zoom), 0.0, 0.0, self.Resolution(zoom) * -1, moriginx, moriginy)
@gijs
gijs / designer.html
Created June 3, 2014 11:38
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;