Skip to content

Instantly share code, notes, and snippets.

View zross's full-sized avatar

Zev Ross zross

View GitHub Profile
@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 / 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 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
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 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
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 / 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 June 18, 2014 13:53
cartodb infowindow trouble
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="">
<head>
<style>
#map1{
height: 400px;
width: 400px;
@zross
zross / esri-leaflet.js
Last active February 22, 2024 17:09
Adding ArcGIS services to LeafletJS
/*! Esri-Leaflet - v0.0.1-beta.4 - 2014-03-09
* Copyright (c) 2014 Environmental Systems Research Institute, Inc.
* Apache License*/
L.esri={_callback:{}},L.esri.Support={CORS:!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest)},L.esri.RequestHandlers={CORS:function(a,b,c,d){var e=new XMLHttpRequest;b.f="json",e.onreadystatechange=function(){var a;if(4===e.readyState){try{a=JSON.parse(e.responseText)}catch(b){a={error:"Could not parse response as JSON."}}d?c.call(d,a):c(a)}},e.open("GET",a+"?"+L.esri.Util.serialize(b),!0),e.send(null)},JSONP:function(a,b,c,d){var e="c"+(1e9*Math.random()).toString(36).replace(".","_");b.f="json",b.callback="L.esri._callback."+e;var f=L.DomUtil.create("script",null,document.body);f.type="text/javascript",f.src=a+"?"+L.esri.Util.serialize(b),f.id=e,L.esri._callback[e]=function(a){d?c.call(d,a):c(a),document.body.removeChild(f),delete L.esri._callback[e]}}},L.esri.get=L.esri.Support.CORS?L.esri.RequestHandlers.CORS:L.esri.RequestHandlers.JSONP,L.esri.Mixins={},
@zross
zross / index.html
Last active July 25, 2016 23:57
TopoJSON to LeafletJS Using D3.js
<html>
<head>
<title>HTML5</title>
<!--D3 code stolen from: http://bost.ocks.org/mike/leaflet/#init-->
<!--This file used in blog post Spatial data on a diet: tips
for file size reduction using TopoJSON (http://bit.ly/1jvHiqF)-->
<meta charset="utf-8" />