From d4aeda94ef042ddf50bf6a81e503d0bd8e932495 Mon Sep 17 00:00:00 2001 From: francois Date: Wed, 17 Jun 2020 10:40:03 +0200 Subject: [PATCH 1/7] Fix Error on cellEnter When zoomingOut, cellEnter was fired on FeatureGrid but was undefined --- src/Layers/FeatureLayer/FeatureGrid.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Layers/FeatureLayer/FeatureGrid.js b/src/Layers/FeatureLayer/FeatureGrid.js index 34ea20b50..03842e8af 100644 --- a/src/Layers/FeatureLayer/FeatureGrid.js +++ b/src/Layers/FeatureLayer/FeatureGrid.js @@ -117,7 +117,10 @@ export var FeatureGrid = Layer.extend({ cellLeave: function () { return; }, - + + cellEnter: function(){ + return; + }, // @section // @method getCellSize: Point // Normalizes the [cellSize option](#gridlayer-cellsize) into a point. Used by the `createCell()` method. From 543c43d169ea35b9d5f80a0426d5fa35704f7792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charbonnier?= Date: Wed, 17 Jun 2020 11:19:36 +0200 Subject: [PATCH 2/7] fix travis error (spaces) --- src/Layers/FeatureLayer/FeatureGrid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Layers/FeatureLayer/FeatureGrid.js b/src/Layers/FeatureLayer/FeatureGrid.js index 03842e8af..a4867c571 100644 --- a/src/Layers/FeatureLayer/FeatureGrid.js +++ b/src/Layers/FeatureLayer/FeatureGrid.js @@ -117,8 +117,8 @@ export var FeatureGrid = Layer.extend({ cellLeave: function () { return; }, - - cellEnter: function(){ + + cellEnter: function () { return; }, // @section From d9d9efd689ea6e96e7e4a1bb232bb1174cffd221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charbonnier?= Date: Fri, 19 Jun 2020 16:04:16 +0200 Subject: [PATCH 3/7] add capability to fetch all features in a cell --- src/Layers/FeatureLayer/FeatureLayer.js | 3 ++- src/Layers/FeatureLayer/FeatureManager.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Layers/FeatureLayer/FeatureLayer.js b/src/Layers/FeatureLayer/FeatureLayer.js index d82465a39..f4b0ba0d0 100644 --- a/src/Layers/FeatureLayer/FeatureLayer.js +++ b/src/Layers/FeatureLayer/FeatureLayer.js @@ -5,7 +5,8 @@ import { warn } from '../../Util'; export var FeatureLayer = FeatureManager.extend({ options: { - cacheLayers: true + cacheLayers: true, + fetchAllFeatures: false }, /** diff --git a/src/Layers/FeatureLayer/FeatureManager.js b/src/Layers/FeatureLayer/FeatureManager.js index 6dfff904d..0ab5f4d85 100644 --- a/src/Layers/FeatureLayer/FeatureManager.js +++ b/src/Layers/FeatureLayer/FeatureManager.js @@ -130,7 +130,7 @@ export var FeatureManager = FeatureGrid.extend({ } }, - _requestFeatures: function (bounds, coords, callback) { + _requestFeatures: function (bounds, coords, callback, offset) { this._activeRequests++; // our first active request fires loading @@ -144,7 +144,7 @@ export var FeatureManager = FeatureGrid.extend({ ); } - return this._buildQuery(bounds).run(function ( + return this._buildQuery(bounds, offset).run(function ( error, featureCollection, response @@ -176,6 +176,9 @@ export var FeatureManager = FeatureGrid.extend({ if (callback) { callback.call(this, error, featureCollection); } + if (response && response.exceededTransferLimit && this.options.fetchAllFeatures) { + this._requestFeatures(bounds, coords, callback, offset + featureCollection.features.length); + } }, this); }, @@ -218,13 +221,14 @@ export var FeatureManager = FeatureGrid.extend({ this.createLayers(features); }, - _buildQuery: function (bounds) { + _buildQuery: function (bounds, offset = 0) { var query = this.service .query() .intersects(bounds) .where(this.options.where) .fields(this.options.fields) - .precision(this.options.precision); + .precision(this.options.precision) + .offset(offset); query.params['resultType'] = 'tile'; From e2d48e5028394ddadc3c5dbb97a594ddb3ece470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charbonnier?= Date: Tue, 23 Jun 2020 11:28:47 +0200 Subject: [PATCH 4/7] fix travis, failed test and add test --- .../Layers/FeatureLayer/FeatureManagerSpec.js | 152 +++++++++++++++++- src/Layers/FeatureLayer/FeatureLayer.js | 3 +- src/Layers/FeatureLayer/FeatureManager.js | 15 +- 3 files changed, 162 insertions(+), 8 deletions(-) diff --git a/spec/Layers/FeatureLayer/FeatureManagerSpec.js b/spec/Layers/FeatureLayer/FeatureManagerSpec.js index b0c5290c0..9ff1a7784 100644 --- a/spec/Layers/FeatureLayer/FeatureManagerSpec.js +++ b/spec/Layers/FeatureLayer/FeatureManagerSpec.js @@ -253,7 +253,6 @@ describe('L.esri.FeatureManager', function () { layer.addTo(map); server.respond(); - expect(layer.createLayers).to.have.been.calledWith([ { type: 'Feature', @@ -1216,5 +1215,156 @@ describe('L.esri.FeatureManager', function () { expect(layer._activeRequests).to.equal(0); expect(triggered).to.be.true; }); + + it('should fetch another request if limit exceeded', function () { + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=0&resultType=tile&f=json', + JSON.stringify({ + fields: fields, + features: [feature6], + objectIdFieldName: 'OBJECTID', + exceededTransferLimit: true + }) + ); + + var layer = new MockLayer({ + url: + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/', + fetchAllFeatures: true + }); + + layer.addTo(map); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([ + { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-109.02, 36.98], + [-102.06, 37.01], + [-102.06, 40.97], + [-109.02, 40.97], + [-109.02, 36.98] + ] + ] + }, + properties: { + OBJECTID: 6, + Name: 'Site 6', + Type: 'Active', + StartTime: new Date('January 14 2014 GMT-0800').valueOf(), + EndTime: new Date('January 15 2014 GMT-0800').valueOf() + }, + id: 6 + } + ]); + + // second call due to fetchAllFeatures + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=1&resultType=tile&f=json', + JSON.stringify({ + fields: fields, + features: [feature5], + objectIdFieldName: 'OBJECTID' + }) + ); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([ + { + geometry: { + type: 'Point', + coordinates: [-122.629394, 45.537134] + }, + id: 5, + properties: { + OBJECTID: 5, + Name: 'Site 5', + Type: 'Active', + StartTime: new Date('January 14 2014 GMT-0800').valueOf(), + EndTime: new Date('January 15 2014 GMT-0800').valueOf() + }, + type: 'Feature' + } + ]); + }); + + it('should not fetch another request even if limit exceeded', function () { + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=json', + JSON.stringify({ + fields: fields, + features: [feature6], + objectIdFieldName: 'OBJECTID', + exceededTransferLimit: true + }) + ); + + var layer = new MockLayer({ + url: + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/' + }); + + layer.addTo(map); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([ + { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-109.02, 36.98], + [-102.06, 37.01], + [-102.06, 40.97], + [-109.02, 40.97], + [-109.02, 36.98] + ] + ] + }, + properties: { + OBJECTID: 6, + Name: 'Site 6', + Type: 'Active', + StartTime: new Date('January 14 2014 GMT-0800').valueOf(), + EndTime: new Date('January 15 2014 GMT-0800').valueOf() + }, + id: 6 + } + ]); + + // unexpected second call + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=1&resultType=tile&f=json', + JSON.stringify({ + fields: fields, + features: [feature5], + objectIdFieldName: 'OBJECTID' + }) + ); + server.respond(); + expect(layer.createLayers).not.to.have.been.calledWith([ + { + geometry: { + type: 'Point', + coordinates: [-122.629394, 45.537134] + }, + id: 5, + properties: { + OBJECTID: 5, + Name: 'Site 5', + Type: 'Active', + StartTime: new Date('January 14 2014 GMT-0800').valueOf(), + EndTime: new Date('January 15 2014 GMT-0800').valueOf() + }, + type: 'Feature' + } + ]); + }); }); /* eslint-enable handle-callback-err */ diff --git a/src/Layers/FeatureLayer/FeatureLayer.js b/src/Layers/FeatureLayer/FeatureLayer.js index f4b0ba0d0..d82465a39 100644 --- a/src/Layers/FeatureLayer/FeatureLayer.js +++ b/src/Layers/FeatureLayer/FeatureLayer.js @@ -5,8 +5,7 @@ import { warn } from '../../Util'; export var FeatureLayer = FeatureManager.extend({ options: { - cacheLayers: true, - fetchAllFeatures: false + cacheLayers: true }, /** diff --git a/src/Layers/FeatureLayer/FeatureManager.js b/src/Layers/FeatureLayer/FeatureManager.js index 0ab5f4d85..9ce87d944 100644 --- a/src/Layers/FeatureLayer/FeatureManager.js +++ b/src/Layers/FeatureLayer/FeatureManager.js @@ -18,7 +18,8 @@ export var FeatureManager = FeatureGrid.extend({ timeField: false, timeFilterMode: 'server', simplifyFactor: 0, - precision: 6 + precision: 6, + fetchAllFeatures: false }, /** @@ -132,7 +133,8 @@ export var FeatureManager = FeatureGrid.extend({ _requestFeatures: function (bounds, coords, callback, offset) { this._activeRequests++; - + // default param + offset = offset || 0; // our first active request fires loading if (this._activeRequests === 1) { this.fire( @@ -221,14 +223,17 @@ export var FeatureManager = FeatureGrid.extend({ this.createLayers(features); }, - _buildQuery: function (bounds, offset = 0) { + _buildQuery: function (bounds, offset) { var query = this.service .query() .intersects(bounds) .where(this.options.where) .fields(this.options.fields) - .precision(this.options.precision) - .offset(offset); + .precision(this.options.precision); + + if (this.options.fetchAllFeatures && !isNaN(parseInt(offset))) { + query = query.offset(offset); + } query.params['resultType'] = 'tile'; From 59552bcb1931a3618cd2cf2acb82d77b2fd6288e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charbonnier?= Date: Wed, 15 Jul 2020 08:44:26 +0200 Subject: [PATCH 5/7] merge proposal --- src/Layers/FeatureLayer/FeatureManager.js | 10 +++++----- src/Tasks/Query.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Layers/FeatureLayer/FeatureManager.js b/src/Layers/FeatureLayer/FeatureManager.js index c00d0c782..08439f20f 100644 --- a/src/Layers/FeatureLayer/FeatureManager.js +++ b/src/Layers/FeatureLayer/FeatureManager.js @@ -76,7 +76,7 @@ export var FeatureManager = FeatureGrid.extend({ // Check if someone has requested that we don't use geoJSON, even if it's available var forceJsonFormat = false; - if (this.service.options.isModern === false) { + if (this.service.options.isModern === false || this.options.fetchAllFeatures) { forceJsonFormat = true; } @@ -133,12 +133,12 @@ export var FeatureManager = FeatureGrid.extend({ _requestFeatures: function (bounds, coords, callback, offset) { this._activeRequests++; - + // default param offset = offset || 0; - + var originalWhere = this.options.where; - + // our first active request fires loading if (this._activeRequests === 1) { this.fire( @@ -191,7 +191,7 @@ export var FeatureManager = FeatureGrid.extend({ this._requestFeatures(bounds, coords, callback, offset + featureCollection.features.length); } }, - this); + this); }, _postProcessFeatures: function (bounds) { diff --git a/src/Tasks/Query.js b/src/Tasks/Query.js index b6305701f..cb4efac58 100644 --- a/src/Tasks/Query.js +++ b/src/Tasks/Query.js @@ -126,7 +126,7 @@ export var Query = Task.extend({ this._cleanParams(); // services hosted on ArcGIS Online and ArcGIS Server 10.3.1+ support requesting geojson directly - if (this.options.isModern || isArcgisOnline(this.options.url)) { + if (this.options.isModern || (isArcgisOnline(this.options.url) && this.options.isModern === undefined)) { this.params.f = 'geojson'; return this.request(function (error, response) { @@ -134,7 +134,7 @@ export var Query = Task.extend({ callback.call(context, error, response, response); }, this); - // otherwise convert it in the callback then pass it on + // otherwise convert it in the callback then pass it on } else { return this.request(function (error, response) { this._trapSQLerrors(error); From 7a3db886b0de30e8398a4dbb2b74503a661dcfd8 Mon Sep 17 00:00:00 2001 From: Gavin Rehkemper Date: Tue, 18 Aug 2020 22:36:09 -0500 Subject: [PATCH 6/7] test for geojson for isModern --- .../Layers/FeatureLayer/FeatureManagerSpec.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/spec/Layers/FeatureLayer/FeatureManagerSpec.js b/spec/Layers/FeatureLayer/FeatureManagerSpec.js index ab76108d6..0525067e8 100644 --- a/spec/Layers/FeatureLayer/FeatureManagerSpec.js +++ b/spec/Layers/FeatureLayer/FeatureManagerSpec.js @@ -213,6 +213,29 @@ describe('L.esri.FeatureManager', function () { } }; + // geojson: + var feature7 = { + 'type': 'Feature', + 'geometry': + { + 'type': 'Polygon', + 'coordinates': + [ + [ + [-90.3038149502124, 38.6539545785218], + [-90.3038498654697, 38.6539303067945], + [-90.3038737094094, 38.6539138632284], + [-90.3039181787535, 38.6538794680055], + [-90.3042877084603, 38.6542092694323], + [-90.3042196068492, 38.6542595646522], + [-90.3041648638806, 38.6542969769789], + [-90.3038149502124, 38.6539545785218] + ] + ] + }, + 'properties': null + }; + it('should be able to add itself to a map', function () { layer.addTo(map); expect(map.hasLayer(layer)).to.equal(true); @@ -1216,6 +1239,27 @@ describe('L.esri.FeatureManager', function () { expect(triggered).to.be.true; }); + it('should fetch as geojson if "isModern" is true', function () { + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=0&resultType=tile&f=geojson', + JSON.stringify({ + 'type': 'FeatureCollection', + 'features': [feature7]}) + ); + + var layer = new MockLayer({ + url: + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/', + fetchAllFeatures: true, + isModern: true + }); + + layer.addTo(map); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([feature7]); + }); + it('should fetch another request if limit exceeded', function () { server.respondWith( 'GET', From 27246691eed9a4781026c552548122086f248c7c Mon Sep 17 00:00:00 2001 From: Gavin Rehkemper Date: Tue, 18 Aug 2020 22:49:49 -0500 Subject: [PATCH 7/7] support response.exceededTransferLimit or response.properties.exceededTransferLimit --- .../Layers/FeatureLayer/FeatureManagerSpec.js | 91 ++++++++++++++++++- src/Layers/FeatureLayer/FeatureManager.js | 2 +- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/spec/Layers/FeatureLayer/FeatureManagerSpec.js b/spec/Layers/FeatureLayer/FeatureManagerSpec.js index 0525067e8..96593ac74 100644 --- a/spec/Layers/FeatureLayer/FeatureManagerSpec.js +++ b/spec/Layers/FeatureLayer/FeatureManagerSpec.js @@ -236,6 +236,23 @@ describe('L.esri.FeatureManager', function () { 'properties': null }; + var feature8 = { + 'type': 'Feature', + 'geometry': + { + 'type': 'Polygon', + 'coordinates': + [ + [ + [-90.3038149502124, 38.6539545785218], + [-90.3038498654697, 38.6539303067945], + [-90.3038737094094, 38.6539138632284] + ] + ] + }, + 'properties': null + }; + it('should be able to add itself to a map', function () { layer.addTo(map); expect(map.hasLayer(layer)).to.equal(true); @@ -1336,7 +1353,79 @@ describe('L.esri.FeatureManager', function () { ]); }); - it('should not fetch another request even if limit exceeded', function () { + it('should fetch another request if limit exceeded - geojson exceededTransferLimit', function () { + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=0&resultType=tile&f=geojson', + JSON.stringify({ + 'type': 'FeatureCollection', + 'features': [feature7], + 'exceededTransferLimit': true + }) + ); + + var layer = new MockLayer({ + url: + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/', + fetchAllFeatures: true, + isModern: true + }); + + layer.addTo(map); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([feature7]); + + // second call due to fetchAllFeatures + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=1&resultType=tile&f=geojson', + JSON.stringify({ + 'type': 'FeatureCollection', + 'features': [feature8] + }) + ); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([feature8]); + }); + + it('should fetch another request if limit exceeded - geojson properties.exceededTransferLimit', function () { + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=0&resultType=tile&f=geojson', + JSON.stringify({ + 'type': 'FeatureCollection', + 'features': [feature7], + 'properties': { + 'exceededTransferLimit': true + } + }) + ); + + var layer = new MockLayer({ + url: + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/', + fetchAllFeatures: true, + isModern: true + }); + + layer.addTo(map); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([feature7]); + + // second call due to fetchAllFeatures + server.respondWith( + 'GET', + 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultOffset=1&resultType=tile&f=geojson', + JSON.stringify({ + 'type': 'FeatureCollection', + 'features': [feature8] + }) + ); + server.respond(); + expect(layer.createLayers).to.have.been.calledWith([feature8]); + }); + + it('should not fetch another request even if limit exceeded when no "fetchAllFeatures"', function () { server.respondWith( 'GET', 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSr=4326&geometry=%7B%22xmin%22%3A-122.6513671875%2C%22ymin%22%3A45.49094569262732%2C%22xmax%22%3A-122.607421875%2C%22ymax%22%3A45.521743896993634%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=json', diff --git a/src/Layers/FeatureLayer/FeatureManager.js b/src/Layers/FeatureLayer/FeatureManager.js index 225f39d0d..9f25fcdff 100644 --- a/src/Layers/FeatureLayer/FeatureManager.js +++ b/src/Layers/FeatureLayer/FeatureManager.js @@ -187,7 +187,7 @@ export var FeatureManager = FeatureGrid.extend({ if (callback) { callback.call(this, error, featureCollection); } - if (response && response.exceededTransferLimit && this.options.fetchAllFeatures) { + if (response && (response.exceededTransferLimit || (response.properties && response.properties.exceededTransferLimit)) && this.options.fetchAllFeatures) { this._requestFeatures(bounds, coords, callback, offset + featureCollection.features.length); } },