AnsweredAssumed Answered

Breaking change in 4.14, smartmapping

Question asked by Noodles484 on Jan 3, 2020
Latest reply on Jan 22, 2020 by Noodles484

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)
});

Outcomes