testing overlaps with bbox
This commit is contained in:
parent
797d3e3953
commit
07bad63fef
|
@ -2,6 +2,7 @@
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from ox.django.shortcuts import render_to_json_response
|
from ox.django.shortcuts import render_to_json_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
from models import Feature
|
||||||
|
|
||||||
def search(request):
|
def search(request):
|
||||||
d = RequestContext(request, {})
|
d = RequestContext(request, {})
|
||||||
|
@ -12,7 +13,11 @@ def search_json(request):
|
||||||
bbox = request.GET.get("bbox", False)
|
bbox = request.GET.get("bbox", False)
|
||||||
if not bbox:
|
if not bbox:
|
||||||
return render_to_json_response({'error': 'no bbox parameter'})
|
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)
|
return render_to_json_response(d)
|
||||||
|
|
||||||
def search_related(request):
|
def search_related(request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user