From f1ead56e6099c22b7794870c877de93c799a4ec6 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 17 Dec 2015 18:01:09 +0100 Subject: [PATCH] disable viewport scale --- query/search.js | 4 +-- .../fixture/search_linguistic_viewport.js | 2 +- test/unit/query/search.js | 34 ++++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/query/search.js b/query/search.js index 91999b1e..764cf999 100644 --- a/query/search.js +++ b/query/search.js @@ -73,8 +73,8 @@ function generateQuery( clean ){ // calculate the centroid from the viewport box vs.set({ 'focus:point:lat': clean['focus.viewport.min_lat'] + ( clean['focus.viewport.max_lat'] - clean['focus.viewport.min_lat'] ) / 2, - 'focus:point:lon': clean['focus.viewport.min_lon'] + ( clean['focus.viewport.max_lon'] - clean['focus.viewport.min_lon'] ) / 2, - 'focus:scale': calculateDiagonalDistance(clean) + 'km' + 'focus:point:lon': clean['focus.viewport.min_lon'] + ( clean['focus.viewport.max_lon'] - clean['focus.viewport.min_lon'] ) / 2 + //, 'focus:scale': calculateDiagonalDistance(clean) + 'km' }); } diff --git a/test/unit/fixture/search_linguistic_viewport.js b/test/unit/fixture/search_linguistic_viewport.js index 46cdc3e9..7cf6d138 100644 --- a/test/unit/fixture/search_linguistic_viewport.js +++ b/test/unit/fixture/search_linguistic_viewport.js @@ -49,7 +49,7 @@ module.exports = { 'lon': -82.50622 }, 'offset': '1km', - 'scale': '994km', + 'scale': '50km', 'decay': 0.5 } } diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 7fa81979..7c421aa6 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -90,22 +90,24 @@ module.exports.tests.query = function(test, common) { t.end(); }); - test('search with viewport diagonal < 1km should set scale to 1km', function(t) { - var query = generate({ - text: 'test', querySize: 10, - 'focus.viewport.min_lat': 28.49135, - 'focus.viewport.max_lat': 28.49137, - 'focus.viewport.min_lon': -87.50622, - 'focus.viewport.max_lon': -87.50624, - layers: ['test'] - }); - - var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/search_linguistic_viewport_min_diagonal'); - - t.deepEqual(compiled, expected, 'valid search query'); - t.end(); - }); + // viewport scale sizing currently diabled. + // ref: https://github.com/pelias/api/pull/388 + // test('search with viewport diagonal < 1km should set scale to 1km', function(t) { + // var query = generate({ + // text: 'test', querySize: 10, + // 'focus.viewport.min_lat': 28.49135, + // 'focus.viewport.max_lat': 28.49137, + // 'focus.viewport.min_lon': -87.50622, + // 'focus.viewport.max_lon': -87.50624, + // layers: ['test'] + // }); + // + // var compiled = JSON.parse( JSON.stringify( query ) ); + // var expected = require('../fixture/search_linguistic_viewport_min_diagonal'); + // + // t.deepEqual(compiled, expected, 'valid search query'); + // t.end(); + // }); test('search search + focus on null island', function(t) { var query = generate({