From 07bad63fef132e33d6f5723c7af0ad90adb493ca Mon Sep 17 00:00:00 2001 From: Sanj Date: Sun, 28 Aug 2011 08:25:39 +0530 Subject: [PATCH] testing overlaps with bbox --- gazetteer/places/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py index 3840f60..d5c044f 100644 --- a/gazetteer/places/views.py +++ b/gazetteer/places/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render_to_response from ox.django.shortcuts import render_to_json_response from django.template import RequestContext +from models import Feature def search(request): d = RequestContext(request, {}) @@ -12,7 +13,11 @@ def search_json(request): bbox = request.GET.get("bbox", False) if not bbox: return render_to_json_response({'error': 'no bbox parameter'}) - d = {} + + bs = bbox.split(",") + bs_param = (float(bs[0]), float(bs[1]), float(bs[2]), float(bs[3])) + features = Feature.search.overlaps(bs_param, search_term) + d = {'c': features.count()} return render_to_json_response(d) def search_related(request):