diff --git a/server/borders_api.py b/server/borders_api.py index 0e63229..79d2889 100755 --- a/server/borders_api.py +++ b/server/borders_api.py @@ -122,10 +122,11 @@ def query_crossing(): ymin = request.args.get('ymin') ymax = request.args.get('ymax') region = request.args.get('region') + points = request.args.get('points') == '1' cur = g.conn.cursor() - sql = """SELECT id, ST_AsGeoJSON(line, 7) as geometry, region, processed FROM {table} + sql = """SELECT id, ST_AsGeoJSON({line}, 7) as geometry, region, processed FROM {table} WHERE line && ST_MakeBox2D(ST_Point(%s, %s), ST_Point(%s, %s)) and processed = 0 {reg}; - """.format(table=config.CROSSING_TABLE, reg='and region = %s' if region else '') + """.format(table=config.CROSSING_TABLE, reg='and region = %s' if region else '', line='line' if not points else 'ST_Centroid(line)') params = [xmin, ymin, xmax, ymax] if region: params.append(region) diff --git a/www/borders.js b/www/borders.js index aef5cab..369ebf5 100644 --- a/www/borders.js +++ b/www/borders.js @@ -108,13 +108,14 @@ function updateBorders() { dataType: 'json' }); - if (map.getZoom() >= 7) { + if (map.getZoom() >= 4) { $.ajax(getServer('crossing'), { data: { 'xmin': b.getWest(), 'xmax': b.getEast(), 'ymin': b.getSouth(), - 'ymax': b.getNorth() + 'ymax': b.getNorth(), + 'points': map.getZoom() >= 8 }, success: processCrossing, dataType: 'json' @@ -148,7 +149,7 @@ function processRouting(data) { for( var f = 0; f < data.features.length; f++ ) { marker = L.marker([data.features[f]["lat"], data.features[f]["lon"]]); marker.bindPopup(routingTypes[data.features[f]["type"]], {showOnMouseOver: true}); - routingGroup.addLayer(marker); + routingGroup.addLayer(marker); } } diff --git a/www/index.html b/www/index.html index c64db32..288daea 100644 --- a/www/index.html +++ b/www/index.html @@ -19,7 +19,7 @@ #osm_actions { display: none; margin-top: 1em; } #info { margin-top: 2em; } #b_delete, #b_clear, .back_del { font-size: 8pt; } - #rename, #split, #join, #point, #divide, #backup { display: none; } + #rename, #split, #join, #point, #divide, #backup, #fixcross { display: none; } .actions input[type='text'] { width: 150px; } #header { border-bottom: 1px solid gray; margin-bottom: 1em; padding-bottom: 1em; } #f_topo, #f_chars, #f_comments, #links { font-size: 10pt; } @@ -161,7 +161,7 @@
-