I'm trying to create a data-driven visualization using a GeoJSONLayer with ArcGIS Javascript 4.14 using "esri/renderers/smartMapping/creators/color" on a field named "Number" (specifically a Class Break Render following this and the documentation) but I'm getting a 404 error and the layer is not rendering properly (only default color). The JSON layer, placed in my root folder, is (I guess) a proper JSON working with other renderers but not with this one.
JSON (sample)
{
"type": "FeatureCollection",
"features": [
{
"id": "12",
"type": "Feature",
"properties": {
"ISO": "DEU",
"NAME_0": "Germany",
"Number": 116,
"Region": "Baden-Württemberg",
"index": 12
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
9.651418686000056,
49.780555725000056
[.........]
[
8.682067871000072,
49.61891174300007
]
]
]
]
}
},
..........
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>TEST</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#sidebar {
z-index: 99;
position: absolute;
top: 0;
right: 0;
height: 100%;
background: rgba(0, 0, 0, 0.5);
width: 320px;
}
#text {
color: white;
padding: 3%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.14/esri/themes/dark/main.css">
<script src="https://js.arcgis.com/4.14/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/GeoJSONLayer",
"esri/renderers/smartMapping/creators/color"
], function(Map, MapView, GeoJSONLayer, colorRendererCreator){
const layer = new GeoJSONLayer({
url: "output.json"
});
layer.opacity = 0.9;
layer.title = "Title";
const map = new Map({
basemap: "dark-gray",
layers: [layer]
});
const view = new MapView({
map: map,
container: "viewDiv",
zoom: 5,
center: [10, 50]
});
const params = {
layer: layer,
field: "Number",
classificationMethod: "quantile",
numClasses: 4,
legendOptions: {
title: "This is the title"
}
};
// generate the renderer and set it on the layer
colorRendererCreator.createClassBreaksRenderer(params).then(function(response) {
layer.renderer = response.renderer;
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
The error is
https://localhost/output.json/generateRenderer?classificationDef=%7B%22type%22%3A%22classBreaksDef%22%2C%22breakCount%22%3A4%2C%22classificationField%22%3A%22Number%22%2C%22classificationMethod%22%3A%22esriClassifyQuantile%22%7D&where=1%3D1&f=json 404
What am I doing wrong?
Thanks in advance. m.