From 293c06f4e25915798f3852614b6f87a1ae683f46 Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Mon, 2 Oct 2017 10:22:24 +0100 Subject: [PATCH] Use the same performance special case for 'country' as well as 'type' Presumably the same fix for odd PostGIS query planning needs to be done for the new 'country' filter as for 'type', since these GET query parameters modify the shape of the query in the same way. --- mapit/views/areas.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mapit/views/areas.py b/mapit/views/areas.py index 6ff9a2f3..7c15eb1f 100644 --- a/mapit/views/areas.py +++ b/mapit/views/areas.py @@ -364,8 +364,9 @@ def areas_by_point(request, srid, x, y, bb=False, format='json'): args = query_args(request, format) type = request.GET.get('type', '') + country = request.GET.get('country', '') - if type and method == 'polygon': + if (type or country) and method == 'polygon': args = dict(("area__%s" % k, v) for k, v in args.items()) # So this is odd. It doesn't matter if you specify types, PostGIS will # do the contains test on all the geometries matching the bounding-box