#!/usr/bin/env python from dgeo import GeoGrid nyc = GeoGrid(-74.034805, -73.891296, 40.800296, 40.66866, 10) html = """ <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Polygon Simple</title> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var myLatLng = new google.maps.LatLng(24.886436490787712, -70.2685546875); var myOptions = { zoom: 5, center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN }; var bermudaTriangle; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var triangleCoords = [ """
import json from dgeo import GeoGrid if(len(sys.argv) < 7): print "Usage: " + sys.argv[0] + " left right top bottom columns name" sys.exit(0) top = float(sys.argv[1]) left = float(sys.argv[2]) bottom = float(sys.argv[3]) right = float(sys.argv[4]) columns = int(sys.argv[5]) name = sys.argv[6] def now(): unix_time = calendar.timegm(time.gmtime()) return unix_time task_queue_directory = "data/tasks/flickr_geo_face/"+name+"/"+str(now()) if not os.path.exists(task_queue_directory): os.makedirs(task_queue_directory) def make_task(cell): task_filename = str(cell.row)+"_"+str(cell.column)+".json" task_file = open(task_queue_directory+"/"+task_filename, "w") task_file.write(json.dumps(cell.toDict())) grid = GeoGrid(left, right, top, bottom, columns) grid.foreach_cell(make_task)