Skip to content

Commit

Permalink
allow override of 'isModern' (Esri#935)
Browse files Browse the repository at this point in the history
* allow override of 'isModern'

Add an option to let users decide to not use geoJSON, even if the
underlying service supports it. Occasionally handy when ArcGIS Server
has geoJSON geometry problems.

* Explicitly set isModern properly

Keep the default for “isModern” to be optimistically true, to preserve
back compatibility. Fix the test to allow metadata to disable geoJSON.

* Remove default value for 'isModern'

Fix tests for ‘isModern’ to not require a default value; update
‘isModern’ as part of the tests for geoJSON support, allowing for a
user override.

* Kill useless test for undefined

Explicit test for false is sufficient.
  • Loading branch information
spoilsportmotors authored and jgravois committed Mar 13, 2017
1 parent e767dd0 commit 7ff19aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Layers/FeatureLayer/FeatureManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,18 @@ export var FeatureManager = VirtualGrid.extend({
this.service.metadata(function (err, metadata) {
if (!err) {
var supportedFormats = metadata.supportedQueryFormats;
// check to see whether service can emit GeoJSON natively
if (supportedFormats && supportedFormats.indexOf('geoJSON') !== -1) {

// 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) {
forceJsonFormat = true;
}

// Unless we've been told otherwise, check to see whether service can emit GeoJSON natively
if (!forceJsonFormat && supportedFormats && supportedFormats.indexOf('geoJSON') !== -1) {
this.service.options.isModern = true;
}

// add copyright text listed in service metadata
if (!this.options.attribution && map.attributionControl && metadata.copyrightText) {
this.options.attribution = metadata.copyrightText;
Expand Down

0 comments on commit 7ff19aa

Please sign in to comment.