Skip to content

Instantly share code, notes, and snippets.

View zross's full-sized avatar

Zev Ross zross

View GitHub Profile
@zross
zross / exp_sidewalkcafes.js
Created August 4, 2014 20:28
qgis2leaf Example
var exp_sidewalkcafes = {
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id_qgis2leaf": 0, "color_qgis2leaf": '#4b8217', "radius_qgis2leaf": 2.5, "transp_qgis2leaf": 1.0, "transp_fill_qgis2leaf": 1.0, "CafeType": "All Cafes", "Shape_Leng": 1246.829238 }, "geometry": { "type": "LineString", "coordinates": [ [ -73.995864681742205, 40.70931879343253 ], [ -73.995719955343887, 40.709341590415235 ], [ -73.994206733869348, 40.709579942150661 ], [ -73.994259568461672, 40.709977648269344 ], [ -73.995971438079593, 40.70971603950121 ], [ -73.995880255834521, 40.709376748462233 ], [ -73.995864681742205, 40.70931879343253 ] ] } },
{ "type": "Feature", "properties": { "id_qgis2leaf": 1, "color_qgis2leaf": '#4b8217', "radius_qgis2leaf": 2.5, "transp_qgis2leaf": 1.0, "transp_fill_qgis2leaf": 1.0, "CafeType": "All Cafes", "Shape
@zross
zross / index.html
Created September 19, 2014 17:42
D3, Leaflet animation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://d3js.org/d3.v3.min.js" type="text/javascript"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
@zross
zross / index.html
Created September 23, 2014 13:58
GeoJSON data on Leaflet Map with MapBox tiles
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
<style>
@zross
zross / index.html
Last active April 11, 2024 08:33
Animate path on Leaflet map using D3 (Gimme!, Proletariat)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://d3js.org/d3.v3.min.js" type="text/javascript"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
@zross
zross / index.html
Created September 29, 2014 19:33
Path on Leaflet Map with odd zoom behavior
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://d3js.org/d3.v3.min.js" type="text/javascript"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
@zross
zross / index.html
Created October 15, 2014 13:58
Leaflet Boilerplate (MapBox tiles)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
<title>Leaflet Boilerplate</title>
@zross
zross / index.html
Created October 15, 2014 14:18
Leaflet Boilerplate (MapBox tiles, Bootstrap, jQuery)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
<title>Leaflet Boilerplate</title>
@zross
zross / knitr_hook.R
Last active May 4, 2016 16:20
Not completely finished hook to add fragment tags to RMarkdown code chunks (slidify, revealjs, R)
s0 <- knitr::knit_hooks$get('source')
o0 <- knitr::knit_hooks$get('output')
p0 <- knitr::knit_hooks$get('plot')
knitr::knit_hooks$set(
list(
source=function(x,options){
if (is.null(options$class)) s0(x, options)
@zross
zross / index.html
Last active July 13, 2017 04:45
Leaflet.js Tips, Step 1 (boilerplate)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<style type="text/css">
#map {
width: 600px;
@zross
zross / index.html
Created October 21, 2014 16:13
Example of Google Places Library (grab cafes within 500m)
<!DOCTYPE html>
<html>
<head>
<title>Place searches</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;