Skip to content

Instantly share code, notes, and snippets.

@youweit youweit/wifly.py forked from davidyen1124/wifly.py
Created Aug 1, 2013

Embed
What would you like to do?
#!/usr/bin/python
import urllib2
import json
import pygmaps
url = 'http://60.199.253.136/api/action/datastore_search?resource_id=d7a1b4c2-cad0-44f2-958a-a9d7a9330c95&limit=10000'
def main():
content = urllib2.urlopen(url).read()
datas = json.loads(content)['result']['records']
mymap = pygmaps.maps(datas[0]['LAT'], datas[0]['LNG'], 16)
for item in datas:
name = item['HOTSPOT_NAME']
try:
lat = float(item['LAT'])
lng = float(item['LNG'])
except ValueError:
continue
print name, lat, lng
mymap.addpoint(lat, lng, '#0000FF')
mymap.draw('./wifly.html')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.