Mitch Hedberg and GIS
njgeo.org
njgeo.org
"Between February and June of 1969 ... no more full-service properties were planned ... difficult to control quality with in-house restaurants ... All inns built after La Quinta #505 were built ... at locations with area available to build a restaurant ... which would be leased to a major restaurant chain for management."
"June, 1969 ... La Quinta #507 ... Restaurant on the premises was leased to Denny's."
http://www.business.txstate.edu/users/jb15/MGT4350/how_la_qu...
http://edition.cnn.com/2010/LIVING/wayoflife/01/06/i.spy.ste...
https://www.google.com/maps/@49.284602,-123.12482,3a,75y,229...
One of them has been closed since this Street View image was taken in 2012, but they were both there for some time (I had worked in the area in 2008 and they both were definitely there then).
You're not invested (usually) in going to a particular Starbucks when you're getting your coffee on the go. This lets them increase the throughput for the area, while also capturing traffic (foot traffic in the case of this setup it seems) from more directions. You want coffee, but it's on the opposite corner then you have to cross two roads two times each? That's inconvenient. You have to cross, in the worst case, one road twice to get coffee in this setup. (Note: I don't think people analyze their behavior to that depth, but ease of access is at least an unconcious factor in determining whether to visit a place.)
http://www.theonion.com/articles/new-starbucks-opens-in-rest...
Brings to mind:
"Humor can be dissected, as a frog can, but the thing dies in the process and the innards are discouraging to any but the pure scientific mind" - E.B. White
The query doesn't need the added "shape" column unless you want it for indexes, and becomes simply:
SELECT d.city, d.state, earth_distance(
ll_to_earth(d.latitude, d.longitude),
ll_to_earth(l.latitude, l.longitude)) as distance
FROM dennys d, laquinta l
WHERE distance <= 150
ORDER BY 3
No more magic numbers or confusing function names.Note I don't mean this as a slight on the article - I purely mean it to educate postgres users that they can do this sort of thing easily without downloading/installing PostGIS.
"Dogs are forever in the pushup position" ~ Mitch
wat.
Using the wrong tool for a really easy job can sometimes be faster than the minimal effort of getting the right tool ready.
So, it doesn't matter much, but it was an odd choice.
... for you.
s/^."n":"(.+)","i":"(.+)","p":\[([\d\.\-]+),([\d\.\-]+)],"s":"(\w+)","c":"(.+)".$/\1,\2,\3,\4,\5/;
{"n":"Homewood","i":"inns_suits","p":[33.455237,-86.81964],"s":"AL","c":"1"},
and then making a regular expression that matches that line literally [1]: m/^{"n":"Homewood","i":"inns_suits","p":\[33.455237,-86.81964\],"s":"AL","c":"1"},/
_ _ _
Then replace the parts that will vary with regular expressions to capture them. We want to capture the "n" field: m/^{"n":"(.*?)","i":"inns_suits","p":\[33.455237,-86.81964\],"s":"AL","c":"1"},/
_____
and the "i" field: m/^{"n":"(.*?)","i":"(.*?)","p":\[33.455237,-86.81964\],"s":"AL","c":"1"},/
_____
and the longitude and latitudes from the "p" field: m/^{"n":"(.*?)","i":"(.*?)","p":\[(.*?),(.*?)\],"s":"AL","c":"1"},/
_____ _____
and the "s" field: m/^{"n":"(.*?)","i":"(.*?)","p":\[(.*?),(.*?)\],"s":"(.*?)","c":"1"},/
_____
We don't care about the "c" field, so I'm going to drop it: m/^{"n":"(.*?)","i":"(.*?)","p":\[(.*?),(.*?)\],"s":"(.*?)"/
If we want to be fancy, we can make sure that the latitude and longitude consist only of digits, decimal points, and minus signs: m/^{"n":"(.*?)","i":"(.*?)","p":\[([\d.-]*?),([\d.-]*?)\],"s":"(.*?)"/
____ ____
For a one time thing like this, I'd probably deal with this data with a pipe in the shell, rather than use regular expressions: tr : , < in | tr -d '[]' | cut -d , -f 2,4,6,7,9 > out.csv
[1] I shall use Perl regular expressioninsert into my_table values ($$ json_goes_here $$);
Works for all stringy things.
1. http://en.wikipedia.org/wiki/Comma-separated_values#Basic_ru...
At the risk of providing something useful to the discussion though, I'd like to point out the excellent tool jq: http://stedolan.github.io/jq/
Here's how to use it for the conversion in the article:
jq '.places[] | [.n,.i,.p[0],.p[1],.s] | map(tostring) | join(",")' hotelMarkers.js
(after editing hotelMarkers.js into a proper json file)