Skip to content

Instantly share code, notes, and snippets.

@bradediger
Created May 1, 2009 22:56
Show Gist options
  • Save bradediger/105311 to your computer and use it in GitHub Desktop.
Save bradediger/105311 to your computer and use it in GitHub Desktop.
shaver_triton=# select a.state, a.name, st_distance(a.the_geom, il.the_geom) from states_provinces a, states_provinces il where a.state != il.state and il.name = 'Illinois' order by st_distance(a.the_geom, il.the_geom) asc;
state | name | st_distance
-------+----------------------+-------------------
21 | Kentucky | 0
19 | Iowa | 0
55 | Wisconsin | 0
18 | Indiana | 0
29 | Missouri | 0
47 | Tennessee | 0.465497409498616
26 | Michigan | 0.700251907865309
05 | Arkansas | 0.944075157989556
27 | Minnesota | 1.14770645565188
28 | Mississippi | 1.97601565530082
01 | Alabama | 2.07802249410466
39 | Ohio | 2.69626511138445
20 | Kansas | 3.22004716976708
13 | Georgia | 3.50661808066704
31 | Nebraska | 3.7993894134887
40 | Oklahoma | 4.24528063220384
51 | Virginia | 4.37827687241008
22 | Louisiana | 4.39358081907332
37 | North Carolina | 4.39840917612402
54 | West Virginia | 4.88597316326093
46 | South Dakota | 5.39687533375758
45 | South Carolina | 5.4527587904481
48 | Texas | 5.82390072156842
12 | Florida | 6.13368280944107
38 | North Dakota | 6.83774471319557
42 | Pennsylvania | 7.00466167165198
36 | New York | 7.76763920713481
24 | Maryland | 8.02105850901214
11 | District of Columbia | 10.3778056629217
08 | Colorado | 10.538826154952
10 | Delaware | 11.740545136365
35 | New Mexico | 11.9011701881303
34 | New Jersey | 11.96683887431
56 | Wyoming | 12.5670784732952
30 | Montana | 13.3928807351878
09 | Connecticut | 13.7988257936464
25 | Massachusetts | 14.0206799174394
50 | Vermont | 14.2156872674792
33 | New Hampshire | 15.009417793175
44 | Rhode Island | 15.662739196248
23 | Maine | 16.6201552693717
49 | Utah | 17.5378523921659
04 | Arizona | 17.8112385886323
16 | Idaho | 19.6183653793136
32 | Nevada | 22.5331373555001
06 | California | 23.3579449154874
41 | Oregon | 25.5275861729486
53 | Washington | 26.0539712308129
72 | Puerto Rico | 27.8924947358752
02 | Alaska | 41.2913157307251
15 | Hawaii | 66.5502356768123
(51 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment