Breaking change in 4.14, smartmapping

981
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
BjörnSchinkel
New Contributor II

Thank you for looking into this.

Removing the minValue & maxValue properties does help if I only would pass one "static" feature value, but doesn't help in my situation, becausse I use a function on the valueExpression property that takes an argument for calculating a return value based on feature fields from the featurelayer. The renderer without the maxValue/minValue properties calculates it's maximum based on the highest value that is returned from that valueExpression function with that specific argument value every time it's rerendered. So if the highest value changes the class break range changes too and that is not what I want. I would like to set the same maximum Value for every rendering of that featurelayer.

0 Kudos