Exemplo n.º 1
0
data_factory = AwsDataFactory(config)
result_queue = MockResultQueue()
task_queue = MockTaskQueue()
worker = Worker(config, result_queue, task_queue, data_factory)
transformer = GeoJsonTransformer(data_factory)
geojson = None

for iter in range(len(police_beats_geojson)):
    police_beat = ComplexPolygonStrategyFactory().from_geojson(police_beats_geojson[iter]["geometry"])

    # Generate the data set of interest
    set_id = str(uuid4())
    age_limit = datetime.datetime.now()
    age_limit -= datetime.timedelta(hours=1)
    age_limit = age_limit.timetuple()
    bounding_box = police_beat.get_bounding_box()
    keywords = ["Mayday", "parade"]
    print "Bounding Box:", bounding_box
    print "Set ID:", set_id
    print "Time:", age_limit
    kwargs = {
        "num_segments": 4,
        "in_data_set_id": "global",
        "out_data_set_id": set_id,
        "min_timestamp": age_limit,
        "complex_filters": [police_beat],
        "min_lat": bounding_box["min_lat"],
        "max_lat": bounding_box["max_lat"],
        "min_lon": bounding_box["min_lon"],
        "max_lon": bounding_box["max_lon"]  # ,
        #        'keywords' : keywords
Exemplo n.º 2
0
franklin_geojson = geojson.loads(open('manual_tests/franklin.geojson').read())
franklin_county = ComplexPolygonStrategyFactory().from_geojson(franklin_geojson['features'][0]['geometry'])

# Set up the components
data_factory = AwsDataFactory(config)
result_queue = MockResultQueue()
task_queue   = MockTaskQueue()
worker       = Worker(config, result_queue, task_queue, data_factory)
transformer  = GeoJsonTransformer(data_factory)

# Generate the data set of interest
set_id    = str(uuid4())
age_limit = datetime.datetime.now()
age_limit += datetime.timedelta(hours=5) - datetime.timedelta(hours=1)
age_limit = age_limit.timetuple()
bounding_box = franklin_county.get_bounding_box()
print "Bounding Box:", bounding_box
print "Set ID:", set_id
print "Time:", age_limit
kwargs = {
    'num_segments' : 4,
    'in_data_set_id' : 'global',
    'out_data_set_id' : set_id,
    'min_timestamp' : age_limit,
    'complex_filters' : [franklin_county],
    'min_lat' : bounding_box['min_lat'],
    'max_lat' : bounding_box['max_lat'],
    'min_lon' : bounding_box['min_lon'],
    'max_lon' : bounding_box['max_lon']
}
print "Filtering data..."