Breaking change in 4.14, smartmapping

984
20
01-03-2020 08:16 AM
DavidChevrier
Occasional Contributor II

Hi,

  I have a website that allows users to select a species of fish and map it.  It uses the javascript api and php to connect to oracle and retrieve the data.  I symbolize that data as points with a gradient color based on the number of individuals caught at that station and the size of the point based on the total weight of that species at that station.  Because the max/min for both variables is widely different between species, I use the smartmapping tools to generate the breaks on the fly.  While I know this isn't the best practice, its the best solution I could come up with, since universal break points won't work. 

 

It works fine in 4.13 and prior, but fails in 4.14.  The error message in the developer tools of chrome and firefox is "d {name: "feature-layer-adapter:insufficient-data", message: "No features are available to calculate statistics", details: undefined}"

 

I'm able to display the data in 4.14 with a single symbol with no problems.  However, when I use any smartmapping tools, it fails.  Even if I just try to symbolize with one property (like just a color ramp based on the number of species caught, and ignore the weight component) it fails with the same error. 

 

I'm looking for advice to make this work in the latest version of your api.  Also, I have not tried this in 2D, it is in a 3D view.

 

Here is the code in question:

currentClassification = "natural-breaks";

var sizeParams = {
  layer: speciesLayer,
  view: view3D,
  field: "CatchWtCal",
  classificationMethod: currentClassification,
  numClasses: 5
};

var colorParams = {
  layer: speciesLayer,
  view: view3D,
  field: "CatchNoCal",
  classificationMethod: currentClassification,
  numClasses: 5
};

sizeRendererCreator.createVisualVariables(sizeParams)
.then(function (response) {
  var sizeVVs = response.visualVariables;
  colorRendererCreator.createClassBreaksRenderer(colorParams)
  .then(function (response1) {
    var colorRend = response1.renderer;
    colorRend.visualVariables = sizeVVs;
    speciesLayer.renderer = colorRend;

    if (!map.layers.includes(speciesLayer)) {
      map.add(speciesLayer);
      filterData();
    }
  })
}).catch(function (error) {
  console.error(error)
});
0 Kudos
20 Replies
DavidChevrier
Occasional Contributor II

Sorry, still getting an error "{name: "feature-layer-adapter:insufficient-data", message: "No features are available to calculate statistics", details: undefined}"

0 Kudos
KristianEkenes
Esri Regular Contributor

Thanks for checking.

0 Kudos
KristianEkenes
Esri Regular Contributor

Sorry. Apparently the last build on js.arcgis.com/next was almost 2 weeks ago (this isn't our daily dev build). So if you check again next Tuesday afternoon then it should have the fix I was talking about. Since Monday is a holiday, checking on Wednesday may be the safer bet.

0 Kudos
KristianEkenes
Esri Regular Contributor

David Chevrier‌ Can you try using the "next" url again?

0 Kudos
DavidChevrier
Occasional Contributor II

Sure, I will try tomorrow

0 Kudos
DavidChevrier
Occasional Contributor II

That did it, works great now!

0 Kudos
BjörnSchinkel
New Contributor II

Hello,

I had the same problem with createClassBreaksRenderer not working with arcgis api 4.14 and the solution was to use the https://js.arcgis.com/next api.

Now it works with equal-interval, but if I try to use natural-breaks or quantile as the classificationMethod I get this error message in the browser console:

"Uncaught (in promise) d {name: "class-breaks:invalid-parameters", message: "'classificationMethod' other than 'equal-interval' is not allowed when 'analyzeData' is false", details: undefined}"

Where is the "analyzeData" property set? I didn't find it in the api documentation.

This is my params:

const params = {
  layer: layer,
  valueExpression: '$feature.Value',
  view: view,
  classificationMethod: 'natural-breaks',             
  numClasses: 10,
  minValue: 0,
  maxValue: 300000
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
KristianEkenes
Esri Regular Contributor

I'm not able to verify this. Do you have a small app you can share that reproduces this issue? I'll investigate it.

0 Kudos
BjörnSchinkel
New Contributor II

ok. I reproduced it with an example in this codepen 

By using the arcgis api "next" I get this message in the Google Chrome console:

If I try to change the api to version 4.14 nothing happens. It looks like the method createClassBreaksRenderer doesn't work right.

0 Kudos
KristianEkenes
Esri Regular Contributor

Thank you for the response. I can repro it now. It has to do with minDataValue/maxDataValue. If you remove them it works. We're investigating some more...

0 Kudos