Created
August 20, 2012 20:53
-
-
Save tmcw/3407807 to your computer and use it in GitHub Desktop.
Turn your Foursquare Data Archive into a GeoJSON file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, json | |
# this script loves this script | |
# https://gist.github.com/3350235 | |
points = [] | |
vids = set() | |
places = glob.glob("checkins/*.json") | |
for p in places: | |
pj = json.load(open(p)) | |
try: | |
if pj['venue']['id'] not in vids: | |
vids.add(pj['venue']['id']) | |
coords = [ | |
pj['venue']['location']['lng'], | |
pj['venue']['location']['lat']] | |
points.append({ | |
'geometry': { | |
'type': 'Point', | |
'coordinates': coords | |
}, | |
'properties': { | |
'name': pj['venue']['name'], | |
'id': pj['venue']['id'] | |
} | |
}) | |
except Exception, e: | |
pass | |
json.dump({ 'type': 'FeatureCollection', 'features': points }, open('checkins.geojson', 'w')) |
Meshu actually has a GeoJSON endpoint also :P http://meshu.io/make/geojson/?url=http://www.dotspotting.org/u/9/sheets/441/export.json&title=SPUR%20Public%20Private
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you should make a http://bl.ocks.org equivalent for taking geojson in a gist and presenting it in a easy to embed web map, e.g. http://pl.ots.org/3363702 goes to gist.github.com/3363702, grabs the first file with a .json extension, and then tries to parse geojson and display it