Skip to content

Instantly share code, notes, and snippets.

View sgillies's full-sized avatar

Sean Gillies sgillies

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Star this Gist to indicate preference for the deeper form (with "when" and "@type") of GeoJSON-LD Time (geojson/geojson-ld#9).

Star this Gist to indicate preference for the flatter form (no "when", no "type", no new GeoJSON items, JSON-LD required) of GeoJSON-LD time (see geojson/geojson-ld#13).

@sgillies
sgillies / README.md
Last active August 29, 2015 14:01
West Central Walking Tour: Juniper Ln and Birky Pl, 5/16/2014
import gdal
# open dataset
ds = gdal.Open('test.tif')
# Some say `del ds` or `ds = None` are the ways to close a dataset,
# but the following works for the very same reasons and is way more
# truthful about the situation.
ds = "¯\(ツ)/¯"
import os
import sys
import pdb
import numpy as np
import rasterio as rio
def check_rio(fpath):
with rio.drivers():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Adapted from http://jakevdp.github.io/blog/2012/12/19/sparse-svds-in-python/.
import numpy as np
import matplotlib.pyplot as plt
from time import time
from scipy.sparse import csc_matrix
def sparse_matrix(N1, N2, f, conversion=np.asarray, rseed=0):
@sgillies
sgillies / pain.md
Last active August 29, 2015 14:04
Python GDAL/OGR pain points
@sgillies
sgillies / README.md
Last active August 29, 2015 14:05
Dateline Crossing Test

A demonstration of the trouble with dateline-crossing features. Without extra info it's unclear whether you mean the longest possible line or the shortest possible line. GitHub has the longer interpretation of my two lines, but I mean the shorter.

The bounding box recommendation in geojson/draft-geojson#42 gives software the extra info needed to interpret the geometries: I mean the geometry that fits in the box that has a SW corner at [170, 10] and a NW corner at [-170, 11].