Skip to content

Instantly share code, notes, and snippets.

View nvkelso's full-sized avatar

Nathaniel V. KELSO nvkelso

View GitHub Profile
@nvkelso
nvkelso / GoogleMaps.js
Created March 6, 2012 00:52
Use Stamen's map tiles in your favorite mapping library, Google Maps version
// replace "toner" here with "terrain" or "watercolor"
var layer = "toner";
var map = new google.maps.Map(document.getElementById("element_id"), {
center: new google.maps.LatLng(37.7, -122.4),
zoom: 12,
mapTypeId: layer,
mapTypeControlOptions: {
mapTypeIds: [layer]
}
});
@nvkelso
nvkelso / ogr_postgis.py
Created September 24, 2012 20:51
OGR in Python with PostGIS
from glob import glob
from os.path import dirname, basename, join
print 'psql -U username -c "TRUNCATE roads_skeletron"'
all_filenames = glob('tmp/*/???????-roads-z12.shp')
for (overall_index, filename) in enumerate(sorted(all_filenames)):
quad = basename(filename)[:7]
@nvkelso
nvkelso / countTiles.py
Created March 1, 2012 22:04 — forked from andrewharvey/countTiles.py
Given a WGS84 bounding box and an OSM tile zoom range calculates a total number of tiles and how much the Amazon Cloud will cost ya.
#!/usr/bin/python
# README
#
# This script is from: https://gist.github.com/1953554
# By Nathaniel Vaughn Kelso and Mike Migurski @ Stamen
#
# Based on script by andrewharvey: https://gist.github.com/1675606
#
# This script should be considered CC0 licensed
@nvkelso
nvkelso / update.md
Created October 16, 2019 21:51
Natural Earth v.5.0.0 localized names summary

x_tempshape/10m_cultural/ne_10m_populated_places

shapefilename var value
./10m_cultural/ne_10m_populated_places.shp New_name 472
./10m_cultural/ne_10m_populated_places.shp Deleted_name 0
./10m_cultural/ne_10m_populated_places.shp Modified_name 26
./10m_cultural/ne_10m_populated_places.shp Empty_name 1121
./10m_cultural/ne_10m_populated_places.shp Same_name 3349
@nvkelso
nvkelso / true-distance-to-shore.py
Created May 30, 2012 22:02 — forked from scw/true-distance-to-shore.py
Example using OGR and Shapely to compute true distances between geometries and points.
#!/usr/bin/env python
# distance_from_shore.py: compute true distance between points
# and closest geometry.
# shaun walbridge, 2012.05.15
# TODO: no indexing used currently, could stand if performance needs
# improving (currently runs in ~1.5hr for 13k points)
from geopy import distance
@nvkelso
nvkelso / english
Created November 14, 2019 17:21
Romania official data
License to use open informationSpatial data set:
Administrative-territorial unitsA. PREAMBLEThe Government of Romania
encourages all public institutions to provide information usingLicense
for Open Government - OGL ROU 1.0, this being adaptedspecificity of the
spatial data set Administrative-territorial units.In summary:You are
allowed to:• Copy, publish, distribute the information• To adapt the
information• Re-use the information for commercial or non-commercial
purposesRespecting the following conditions:• you must declare the
source of the information by displaying the text of the assignment
attached byto the licensor and, as far as possible, the address where
@nvkelso
nvkelso / ne_10m_admin_0_countries.changes_log.csv.md
Last active October 16, 2019 21:49
Natural Earth v5.0.0 localized name updates
wd_id status variable value_old value_new
Q252 NEWvalue_NEW_LANG NAME_HE אינדונזיה
Q252 NEWvalue_NEW_LANG NAME_UK Індонезія
Q252 NEWvalue_NEW_LANG NAME_UR انڈونیشیا
Q833 NEWvalue_NEW_LANG NAME_HE מלזיה
Q833 MODvalue NAME_IT Malesia Malaysia
Q833 NEWvalue_NEW_LANG NAME_UK Малайзія
Q833 NEWvalue_NEW_LANG NAME_UR ملائیشیا
Q298 NEWvalue_N

Mapzen's Bike Map (read blog post) uses OpenStreetMap tags and relations to color roads and paths according to their (relative) safely. See legend at right.

The OpenStreetMap tag rendering logic is in the Walkabout repo (view source).

This GIST is a human readable version:

Walkabout Bike Map Legend

Tier 1a: Dark Green (off-road)

@nvkelso
nvkelso / bubble_wrap_v11_hacks.yaml
Last active January 10, 2019 00:46
Collision rank
ux_ui:
mz_route_start:
priority: 1
mz_route_destination:
priority: 1
road-labels:
labels-highway-z13-z14:
priority: 50
labels-trunk_primary-default:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.