migurski/whereami — pull request #1 by straup (2013-02-15 16:21:40+00:00)
Title: "wsgi" branch to enable a httpony mode for whereami

Mostly just a bunch of moving code around and putting all the stuff that was in __main__ in to its own function. I tried to make sure the existing interface (and output) remains unchanged.

Dunno if the keys make sense

$> ./whereami.py 37.763251 -122.424002 37.768476 -122.417865
northeast: 37.76847600 -122.41786500
upper-left: -13628177.56 4546770.67
lower-right: -13627494.40 4546034.89
southwest: 37.76325100 -122.42400200

http://www.openstreetmap.org/?box=yes&bbox=-122.424002%2C37.768476%2C-122.417865%2C37.763251

$> gunicorn whereami:app

$> curl 'http://localhost:8000/37.763251/-122.424002/37.768476/-122.417865' | python -mjson.tool
{
"lower-right": "-13627494.40 4546034.89",
"northeast": "37.76847600 -122.41786500",
"southwest": "37.76325100 -122.42400200",
"upper-left": "-13628177.56 4546770.67",
"url": "http://www.openstreetmap.org/?box=yes&bbox=-122.424002%2C37.768476%2C-122.417865%2C37.763251"
}