Shawn Allen shawnbot

View README.md

This tweak to my original example uses a Mercator projection rather than Albers USA, which straightens out many of the state borders and puts Alaska and Hawaii in their right places.

Good call, Jeremy Stucki!

View README.md

This example shows how to use d3 to create uniformly scaled geographic feature thumbnails. There are two interesting features of SVG at play here:

  1. The viewBox attribute is used to "zoom in" to the individual states.
  2. The use element is used to redraw a common background states path into each thumbnail, reducing DOM overhead.

The other nice thing here is that we didn't have to define the SVG elements'

View README.md
View README.md

This gist shows how to restrict d3's zoom behavior so that users can't pan outside of a rectangular bounding box. Use your scroll wheel to zoom in and out of the field of circles, and click and drag to move when zoomed in. Note how when you zoom back out (by scrolling up) the view snaps to the original extent at zoom 1.

View stamen.txt
1 2 3 4 5 6 7 8 9 10
.x+=:. s
z` ^% :8
. <k .88 .. . : u. u.
.@8Ned8" :888ooo u .888: x888 x888. .u x@88k u@88c.
.@^%8888" -*8888888 us888u. ~`8888~'888X`?888f` ud8888. ^"8888""8888"
x88: `)8b. 8888 .@88 "8888" X888 888X '888> :888'8888. 8888 888R
8888N=*8888 8888 9888 9888 X888 888X '888> d888 '88%" 8888 888R
%8" R88 8888 9888 9888 X888 888X '888> 8888.+" 8888 888R
@8Wou 9% .8888Lu= 9888 9888 X888 888X '888> 8888L 8888 888R
.888888P` ^%888* 9888 9888 "*88%""*88" '888!` '8888c. .+ "*88*" 8888"
View Makefile
1 2
test:
source .env && echo "my secret key is: $$SECRET_KEY"
View preflight.sh
1 2 3
hostname=http://example.com
url=http://cors-enabled-server.com/path/to/data.json
curl -H "Origin: ${hostname}" -X OPTIONS -H "Access-Control-Request-Method: GET" -I "${url}"
View index.html
1 2 3 4 5 6 7 8 9 10
<!DOCTYPE html>
<meta charset="utf-8">
<style>
 
.graticule {
fill: none;
stroke: #777;
}
 
.boundary {
View ogr2csv.sh
1 2 3 4
#!/bin/sh
ogr2ogr -F CSV -lco GEOMETRY=AS_XY -t_srs EPSG:4326 $2_dir $1
mv $2_dir/*.csv $2
rm -r $2_dir
View index.md

Finding the Simulator

You can test with the iOS Simulator that comes with Xcode. Navigate to the Xcode app in the Finder, right click and select "Show Package Contents":

screen shot 2013-05-06 at 12 04 27 pm

Then navigate to Contents > Applications, and open the shortcut to "iPhone Simulator" (it may be called "iOS Simulator" depending on which version of Xcode you're running):

screen shot 2013-05-06 at 12 05 45 pm

Something went wrong with that request. Please try again.