The ArcGIS JavaScript ClassBreaksRenderer does not seem to be functioning properly as the layer is only displaying the

Having an issue with my ArcGIS map where only the default symbol is rendering when I add a ClassBreaksRenderer to my GeoJSONLayer.

  // Color Logic

  const low = {
    type: "simple-fill",
    color: "#fc8d59",
    style: "solid",
    outline: {
      width: 0.2,
      color: [255, 255, 255, 0.5],
    },
  };

  const medium = {
    type: "simple-fill",
    color: "#99d594",
    style: "solid",
    outline: {
      width: 0.2,
      color: [255, 255, 255, 0.5],
    },
  };

  const high = {
    type: "simple-fill",
    color: "#0d2644",
    style: "solid",
    outline: {
      width: 0.2,
      color: [255, 255, 255, 0.5],
    },
  };

  let renderer = new ClassBreaksRenderer({
    field: "sum_aqi_mean",
    defaultSymbol: {
      type: "simple-fill",
      color: "black",
      style: "backward-diagonal",
      outline: {
        width: 0.5,
        color: [50, 50, 50, 0.6],
      },
    },
    classBreakInfos: [
      {
        minValue: 0,
        maxValue: 1,
        symbol: low,
        label: "Low",
      },
      {
        minValue: 1,
        maxValue: 2,
        symbol: medium,
        label: "Medium",
      },
      {
        minValue: 2,
        maxValue: 3,
        symbol: high,
        label: "High",
      },
    ],
  });

  const blob = new Blob([JSON.stringify(layers)], {
    type: "application/json",
  });
  const url = URL.createObjectURL(blob);
  const geo = new GeoJSONLayer({
    url: url,
    renderer: renderer,
    popupTemplate: template,
  });

Encountering an issue where my map only displays the default symbol as shown in this screenshot Map only renders default symbol. The value displayed in the popup is based on the polygon's sum_aqi_mean value.

Can someone help me troubleshoot this problem?

Answer №1

Answering a question I had for myself.

I realized that in another part of my code, I was dynamically creating polygons and mistakenly assigning the raw data's sum_aqi_mean property to each polygon's aqi property.

By accessing the aqi field in the ClassBreaksRenderer, everything now functions as it should.

let renderer = new ClassBreaksRenderer({
field: "aqi",
defaultSymbol: {
  type: "simple-fill",
  color: "black",
  style: "backward-diagonal",
  outline: {
    width: 0.5,
    color: [50, 50, 50, 0.6],
  },
}});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining two elements in a React application

Having a collection of assets and their quantities: const bag = { eth: 50, btc: 30, kla: 10, set: 5, ova: 5 }; const assetList = { eth: { name: "Ethereum", icon: "urlhere", colour: "#030", text: "light&q ...

Is there a way to retrieve the Angular-Redux store in a child module?

Within my Angular application, I utilize angular-redux for managing the application state. In my main module, I have defined the redux store in the following manner: export class MainModule { constructor(private ngRedux: NgRedux<MainAppState>, ...

What is causing the TouchSwipe jQuery plugin not to function in my code?

I have integrated the TouchSwipe jQuery plugin into my code to detect mouse movement and display the number of pixels moved when swiping left or right. To download the TouchSwipe jQuery plugin, I visited this link: TouchSwipe and then proceeded to use it ...

Guide on sending a JavaScript variable to PHP using AJAX

I am currently utilizing the following JavaScript code to obtain data from a td element when a button is clicked within an onclick event. function rfk(element) { var element = element.parentElement.parentElement; var id = parseInt(element.childre ...

Combine going to an anchor, performing an AJAX request, and opening a jQuery-UI accordion tab all within a

My goal is to have the user click on the hyperlink below, which will (1) anchor to #suggestions, (2) navigate to the url suggestions.php?appid=70&commentid=25961, and (3) open the jquery-ui accordion #suggestions. However, I am facing an issue where c ...

Preserving Scroll Location Through Back Button Usage and Ajax Manipulation of the Document Object Model

Currently, I am incorporating a feature where results are loaded in using ajax with an infinite scroll. However, there is an issue when a user clicks on an item in the list and navigates away from the page - upon returning by clicking the back button, they ...

Use jQuery's .each method to reiterate through only the initial 5 elements

Is there a way to loop through just the initial 5 elements using jQuery's each method? $(".kltat").each(function() { // Restrict this to only the first five elements of the .kltat class } ...

"Exploring the functionality of HTML buttons on iOS Safari with Angular click

Currently, I am developing a web app that includes a feature where users can hold down a button to adjust a value. The backend of the app is supported by Meteor.js with Angular serving as the front end. The functionality works perfectly, except for Mobile ...

Could you offer assistance in resolving the error I am encountering with the collection.get() function?

I encountered an issue while trying to implement a database in my project. I imported 'collection' to use in my code. Here is the snippet: import { initializeApp } from "https://www.gstatic.com/firebasejs/9.0.2/firebase-app.js"; import ...

What could be causing my Amazon slot to return an undefined value?

Currently, I am working through this tutorial: https://medium.com/@itsHabib/integrate-an-amazon-lex-chatbot-into-a-react-native-app-1536883ccbed Upon running my chatbot, the JSON output is as shown below: { "dialogState": "Fulfilled", "intentName": ...

Deactivate every checkbox in a row within an array

Seeking assistance with disabling a specific checkbox within a row. For example, Consider the following scenario {availableBendsHostnames?.map((bEnds, indx) => ( <div key={indx}> <div>B-End: {bEnds}</div> ...

What is the best way to choose a specific row with Enzyme?

We have chosen Jest for doing UI Test-Driven Development on our React application. Our component rendering structure looks like this: <Div> <Row> </Row> <ROW> <Row> <ROW> <Link> <Link> ...

Incorrect outcome when utilizing ajax to update a div within a for each loop

For a while now, I've been facing an issue with a div and form within a forEach loop. When one of the forms in the loop is submitted, the content inside the corresponding div is updated in the database and refreshed using JavaScript and Ajax. The upda ...

Consistently encountering issues when attempting to submit JSON data via POST request (body in raw format

I'm facing an issue with sending data to my server. Currently, I am working on a project using react native and axios version ^0.16.2. let input = { 'longitude': -6.3922782, 'latitude': 106.8268856, 'content': &apos ...

"Learn the trick to concealing a modal and unveiling a different one with the power of jquery

Whenever I try to open a modal, then click on a div within the modal in order to close it and open another one, I encounter an issue. The problem is that upon closing the first modal and attempting to display the second one, only the background of the seco ...

Execute the JavaScript [ window:print() ] function once the webpage has finished loading along with any

I am facing an issue with my web page that has around 10 Google Analytics charts. I want to trigger a print dialog box once the page is fully loaded, including all the charts and JavaScript. Currently, the problem is that the print dialog box opens after t ...

Ways to store debug logs in a file within my project

In the project I am currently working on, I incorporate the Debug package which can be found at https://www.npmjs.com/package/debug. As part of this setup, I have set an environment variable (variable name: DEBUG & value:*). As a result, I am able to vie ...

Utilizing children as a prop within a Vue component

In React, I can create a FancyList component like this: const FancyList : React.SFC<{},{}> ({children}) => ( <ul> {...children} </ul> ); const FancyListItem : React.SFC<{text: string}, {}> ({children}) => < ...

Display sub-objects within Chart.js

I'm currently tackling a project in Ionic 3 where I am utilizing an API that returns a JSON response with nested objects. My goal is to display certain aspects of these objects within a bar graph using chart.js. Unfortunately, I lack experience in ma ...

Custom providers do not override Angular UrlResolver

In my Angular application, I am trying to implement a custom UrlResolver provider to incorporate cache breaking logic. I came across this question on Stack Overflow: . Unfortunately, it seems that overriding the default compiler UrlResolver using a provid ...