Created
August 1, 2013 14:26
-
-
Save youweit/6131865 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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