Exemplo n.º 1
0
def export_areas():
    compounddate = request.args.get('compounddate','')
    
    if not compounddate:
        abort(400)
    
    month = compounddate[4:6]
    year  =  compounddate[0:4]
    start = datetime.date(int(year), int(month), 1)
    start = datetime.datetime.combine(start, datetime.time())
    end   = datetime.date(int(year), int(month), calendar.monthrange(int(year), int(month))[1])
    end   = datetime.datetime.combine(end, datetime.time())
    
    report   = Report.find_by_period(start, end)
    polygons = Cell.polygon_by_report(report)
    
    return json.dumps(polygons)