Exemplo n.º 1
0
def getRGsForBox(request):
    l = float( request.GET['x1'] )
    b = float( request.GET['y1'] )
    r = float( request.GET['x2'] )
    t = float( request.GET['y2'] )
    
    index = Rtree('/home/renci/geoanalytics/geoanalytics-lib/rg')
    ids = list(index.intersection((l,b,r,t), objects=True))
    rgs = []
    if len(ids) > 0:
        rgs = [{
            'name' : r.name,
            'filepath' : r.filepath, 
            'bounds' : r.bbox4326, 
            'seriescount' : Series.objects(record_group=r).count() 
        } for r in [RecordGroup.objects(id=i.object).first() for i in ids]]
    return HttpResponse(json.dumps(rgs), mimetype='application/json')
Exemplo n.º 2
0
def recordgroup(request):
    o = { 'children' : [_make_node(d) for d in RecordGroup.objects(**dict(_fudge(request.REQUEST.items())))] }
    return HttpResponse(json.dumps(o,  default=json_util.default), mimetype='application/json')