From f2cde0bfef0f9190e342c5612107d8835a10984c Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 6 Jun 2016 20:45:14 -0400 Subject: [PATCH] Limit number of pages to fetch from Mapillary search API (closes #3149) --- js/id/services/mapillary.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/id/services/mapillary.js b/js/id/services/mapillary.js index 68e926a0b..1506c385c 100644 --- a/js/id/services/mapillary.js +++ b/js/id/services/mapillary.js @@ -6,6 +6,7 @@ iD.services.mapillary = function() { viewerjs = 'https://npmcdn.com/mapillary-js@1.3.0/dist/mapillary-js.min.js', clientId = 'NzNRM2otQkR2SHJzaXJmNmdQWVQ0dzo1ZWYyMmYwNjdmNDdlNmVi', maxResults = 1000, + maxPages = 10, tileZoom = 14; @@ -185,6 +186,7 @@ iD.services.mapillary = function() { if (err || !data.features || !data.features.length) return; var features = [], + nextPage = page + 1, feature, loc, d; for (var i = 0; i < data.features.length; i++) { @@ -202,8 +204,8 @@ iD.services.mapillary = function() { if (which === 'images') dispatch.loadedImages(); if (which === 'signs') dispatch.loadedSigns(); - if (data.features.length === maxResults) { - loadTilePage(which, url, tile, ++page); + if (data.features.length === maxResults && nextPage < maxPages) { + loadTilePage(which, url, tile, nextPage); } } );