From baa77bd3a22e10c34f08f2acaba08cd9809ed622 Mon Sep 17 00:00:00 2001 From: Alexey Zakharenkov <35913079+alexey-zakharenkov@users.noreply.github.com> Date: Tue, 24 Nov 2020 12:08:47 +0300 Subject: [PATCH] Fix function name --- web/app/borders_api.py | 10 +++++----- web/app/borders_api_utils.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/app/borders_api.py b/web/app/borders_api.py index 57e72b5..c04c46d 100755 --- a/web/app/borders_api.py +++ b/web/app/borders_api.py @@ -142,7 +142,7 @@ def query_bbox(): borders = fetch_borders( table=borders_table, simplify=simplify, - where_clause=geom_inside_bbox_sql(xmin, ymin, xmax, ymax) + where_clause=geom_intersects_bbox_sql(xmin, ymin, xmax, ymax) ) return jsonify( status='ok', @@ -166,7 +166,7 @@ def query_small_in_bbox(): FROM ( SELECT id, name, (ST_Dump(geom)).geom AS ring FROM {borders_table} - WHERE {geom_inside_bbox_sql(xmin, ymin, xmax, ymax)} + WHERE {geom_intersects_bbox_sql(xmin, ymin, xmax, ymax)} ) g WHERE ST_Area(geography(ring))/1E6 < %s """, (config.SMALL_KM2,) @@ -729,7 +729,7 @@ def make_osm(): borders_table = config.OTHER_TABLES.get(borders_table, config.BORDERS_TABLE) borders = fetch_borders( table=borders_table, - where_clause=geom_inside_bbox_sql(xmin, ymin, xmax, ymax) + where_clause=geom_intersects_bbox_sql(xmin, ymin, xmax, ymax) ) xml = borders_to_xml(borders) return Response(xml, mimetype='application/x-osm+xml') @@ -860,8 +860,8 @@ def export_poly(): xmax = request.args.get('xmax') or 'NULL' ymin = request.args.get('ymin') or 'NULL' ymax = request.args.get('ymax') or 'NULL' - fetch_borders_args['where_clause'] = geom_inside_bbox_sql(xmin, ymin, - xmax, ymax) + fetch_borders_args['where_clause'] = geom_intersects_bbox_sql(xmin, ymin, + xmax, ymax) borders = fetch_borders(**fetch_borders_args) memory_file = io.BytesIO() diff --git a/web/app/borders_api_utils.py b/web/app/borders_api_utils.py index caf69f8..6b6f967 100644 --- a/web/app/borders_api_utils.py +++ b/web/app/borders_api_utils.py @@ -13,7 +13,7 @@ from subregions import ( ) -def geom_inside_bbox_sql(xmin, ymin, xmax, ymax): +def geom_intersects_bbox_sql(xmin, ymin, xmax, ymax): return (f'(geom && ST_MakeBox2D(ST_Point({xmin}, {ymin}),' f'ST_Point({xmax}, {ymax})))')