Skip to content

Instantly share code, notes, and snippets.

View mattmakesmaps's full-sized avatar

Matthew Kenny mattmakesmaps

View GitHub Profile
@mattmakesmaps
mattmakesmaps / numpyerror.py
Created July 11, 2013 03:57
numpy traceback error with ArcGIS Desktop 10.1
>>> import arcpy
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 24, in <module>
from arcpy.toolbox import *
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\toolbox.py", line 342, in <module>
from management import Graph, GraphTemplate
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 22, in <module>
import _management
@mattmakesmaps
mattmakesmaps / 9_147_196_1.topojson
Created October 9, 2013 06:04
TileStache VecTiles provider test. rendering TMS address 9,147,196. "simplify" parameter values of 1,2,10,100.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattmakesmaps
mattmakesmaps / s00_9_147_196.topojson
Last active December 25, 2015 01:39
TileStache VecTiles provider test. rendering TMS address 9,147,196. "simplify" parameter values of 1,2,10,100. TODO: Update GIST to include SQL statement passed into PostGIS for WKB extraction.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"osm-processed_p1": { // Layer Name
// Sets ACCESS-CONTROL-ALLOW-ORIGIN header to "*"
"allowed origin": "*",
"provider": {
"class": "TileStache.Goodies.VecTiles:Provider",
// PostGIS Connection Info
"kwargs": {
"dbinfo": {
"host": "localhost",
"user": "matt",

Fun with vector maps

Quick TopoJSON vector tile demo map, derived from an earlier GeoJSON demo. Original README follows.

A goofy slippy map of various vector tile data sources. With some fun colours, greetz to Aaron and Mike and Mike and the whole Prettymaps crew.

Sacramento, CA

@mattmakesmaps
mattmakesmaps / gist:8050735
Created December 20, 2013 05:25
An example of the applied duck-type interface within common python built-in functions. The len() built-in will successfully execute on any input that meets its interface criteria: a __len__() method that returns an integer.
Python 2.7.6 (default, Dec 7 2013, 21:06:22)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyClass(object):
... def __init__(self):
... self.foo = "foo"
...
>>> m = MyClass()
>>> m.foo
'foo'
@mattmakesmaps
mattmakesmaps / iter_examples.py
Last active January 4, 2016 18:49
Context Managers, __iter__ implemented as a generator, and multiple decorators.
__author__ = 'matt'
__date__ = '1/27/14'
"""
Create an example Reader class that implements a context manager and __iter__ method.
Use this Reader class in a with statement in conjunction with a Writer class.
Processing classes are examples of class-based decorator patterns. These operate
on the Writer class' public interface, the write() method.
@mattmakesmaps
mattmakesmaps / test_lakes.geojson
Created April 26, 2014 04:24
Created from Natural Earth dataset `50_m_lakes_utf8.shp`. SHP loaded into QGIS 2.1.0, Exported as GeoJSON by right-clicking layer in TOC, and selecting `Save As...`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattmakesmaps
mattmakesmaps / 50m_lakes_subset.geojson
Created April 26, 2014 04:27
Created from Natural Earth dataset `50_m_lakes_utf8.shp`. SHP loaded into QGIS 2.1.0, Exported as GeoJSON by right-clicking layer in TOC, and selecting `Save As...`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.