Exemple #1
0
def map_browse_json(request):

    load = DataLoader()

    #lat "lon": -122.26691648086924, "address": "2214 BROADWAY OAKLAND CA", "lat": 37.811080264089874
    lat = 37.811080264089874,
    lng = -122.26691648086924
    if request.GET.get('lat',None):
        lat = float(request.GET.get('lat',None))
    if request.GET.get('lng',None):
        lng = float(request.GET.get('lng',None))

    r = '5km'
    if request.GET.get('r',None):
        r = request.GET.get('r',None)

    term = None
    if request.GET.get('term',None):
        term = request.GET.get('term',None)

    if term:
        results = load.query_term_geo(term,lat,lng,r,'inspection','facility')
    else:
        results = load.query_geo(lat,lng,r,'inspection','facility')

    records = []
    for index_record in results:
        records.append(index_record)

    return HttpResponse(json.dumps(records),'application/json')