Skip to content

Instantly share code, notes, and snippets.

View nvkelso's full-sized avatar

Nathaniel V. KELSO nvkelso

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nvkelso
nvkelso / scene.yaml
Last active November 16, 2016 07:22
import: https://mapzen.com/carto/refill-style/4/refill-style.yaml
sources:
_nps_boundary:
type: GeoJSON
url: https://gist.githubusercontent.com/rfriberg/684645c22f495b4a46f29fb312b6d268/raw/843ed38a3920ed199082636fe198ba995f5cfc04/san_juan_nhp.geojson
_nps_geology:
type: GeoJSON
url: https://gist.githubusercontent.com/rfriberg/3c09fe3afd642224da7cd70aff1c1e70/raw/1f1df59f4cb4e82d7ea23452c789bc99c299a5cb/san_juan_nhp_geology.geojson
@nvkelso
nvkelso / index.html
Last active November 16, 2016 07:23
<!DOCTYPE html>
<html lang="en">
<head>
<title>San Juan Island Geology</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
<script src="https://mapzen.com/js/mapzen.min.js"></script>
<style>
#map {
height: 100%;
@nvkelso
nvkelso / migration-guide-v1.0-mapzen-vector-tiles.md
Last active February 18, 2017 18:27
Migration Guide for v1.0 Mapzen Vector Tiles

This is a cheat sheet summarizing the v1.0 Mapzen Vector Tiles CHANGLELOG's major breaking changes that we used to update Mapzen house styles.

  • Topic
    • example Tangram scene file YAML old > new

===

  • new tile url sources:
    • https://vector.mapzen.com/osm/all/{z}/{x}/{y}.mvt > https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.mvt
@nvkelso
nvkelso / z16-z17-poi-hiding.yaml
Last active February 26, 2016 06:50
v0.8 Mapzen Vector Tiles poi layer changes
minor-z17-early:
filter:
kind: [accountant, administrative, advertising_agency, architect, association, atm, bakery, bed_and_breakfast, bicycle, bicycle_parking, bicycle_rental, books, bus_stop, bus_stop, butcher, car, car_repair, chalet, clothes, company, computer, consulting, convenience, doityourself, drinking_water, dry_cleaning, educational_institution, emergency_phone, employment_agency, estate_agent, fashion, financial, florist, foundation, gate, gift, government, greengrocer, guest_house, hairdresser, hostel, hotel, insurance, it, jewelry, lawyer, mast, memorial, mobile_phone, motel, newspaper, ngo, notary, optician, parking, pet, physician, playground, political_party, post_box, religion, research, slipway, subway_entrance, tax_advisor, telecommunication, telephone, theatre, therapist, toilets, traffic_signals, travel_agent, water_tower, yes]
area: false
$zoom: { max: 17 }
draw:
@nvkelso
nvkelso / .screenrc
Created April 29, 2013 22:19
Screen configuration, from @mojodna
shell -/bin/bash # Use bash (and load bash_profile, bashrc, etc.)
startup_message off # No startup mesage
msgwait 1 # Show messages for only one second
escape `z # Use CTRL+Z for escape instead of CTRL+A
defscrollback 30000 # Use a 30000-line scrollback buffer
bindkey -k kP copy # bind shift+page-up/down to screen page up/down
bindkey ^[[5C next # bind ctrl-<right> to next shell
bindkey ^[[5D prev # bind ctrl-<left> to prev shell
bindkey ^[[1;5C next # alternate ctrl-<right> mapping
bindkey ^[[1;5D prev # alternate ctrl-<left> mapping
@nvkelso
nvkelso / gist:5226325
Created March 23, 2013 03:32
Color code GIT on the command line.
source /usr/local/etc/bash_completion
function __git_status_flag {
git_status="$(git status 2> /dev/null)"
remote_pattern="^# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status} =~ "nothing to commit" ]]; then
state="⚡"
spacer=" "
fi
@nvkelso
nvkelso / indexShapefile.py
Created November 16, 2012 21:45 — forked from williamscraigm/indexShapefile.py
Build a spatial index for all shapefiles in a directory with ArcGIS
import arcpy
from arcpy import env
import os
# Set the workspace for the ListFeatureClass function
#
env.workspace = "C:\\data\\mydata"
# Use the ListFeatureClasses function to return a list of
# all shapefiles.
@nvkelso
nvkelso / import.sh
Created October 24, 2012 22:25
Importing SHPs of Windows 1252 into UTF PostGIS using ORG's PostGIS driver (not shp2pgsql)
#!/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>"
@nvkelso
nvkelso / size_order.sql
Created October 24, 2012 01:54 — forked from andrewxhill/size_order.sql
Order polygons by size/height
WITH RECURSIVE dims AS (SELECT 2*sqrt(sum(ST_Area(the_geom))) as d, sqrt(sum(ST_Area(the_geom)))/20 as w, count(*) as rows FROM osm_export_polygon WHERE the_geom IS NOT NULL),
geoms AS (SELECT the_geom, ST_YMax(the_geom)-ST_YMin(the_geom) as height FROM osm_export_polygon WHERE the_geom IS NOT NULL ORDER BY ST_YMax(the_geom)-ST_YMin(the_geom) DESC),
geomval AS (SELECT the_geom, row_number() OVER (ORDER BY height DESC) as id from geoms),
positions(the_geom,x_offset,y_offset,new_row,row_offset) AS (
(SELECT the_geom, 0.0::float, 0.0::float, FALSE, 2 from geomval limit 1)
UNION ALL
(
SELECT
(SELECT the_geom FROM geomval WHERE id = p.row_offset),
CASE WHEN