I'm trying to use a renderer and a legend on data from a featureSet, it displayes symbols and popups but the renderer fails.
The data comes from a featureLayer but I display it with view.graphics so I think that may be the problem. Still I can't find an add graphic (maybe addAttachment but I could not make it work) .
This is my code:
var layer = new FeatureLayer({ url:'https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/la_county_labor_centroid/FeatureServer/0'});
function succ(featureSet) {
layer.applyEdits({addFeatures:featureSet})
map.add(layer)
};
function fail(error) {
console.error('An error ocurred in the query: ', error);
};
on(dom.byId('population'), 'change', function (e) {
var population = e.target.value;
if (population.length > 0) {
var query = new Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.where = "TOTAL_POP > " + population;
layer.queryFeatures(query).then(succ,fail)
}
});
});
heres my code pen:
https://codepen.io/segev-salman/pen/MdmrLB
the first time i use the select it refreshes the layer and adds the feature set but it doesnt query it(returns the full layer instead of asked data), but thats it, the promise returns the FeatureSet but it doesn't apply the edits Do I need a new featureLayer or can I use the one with the URL to the service to be displayed with the renderer with queryed data and if not do I really have to insert the data manually after the query does it just bring me back graphics or changes the layer?
I know about definitionExpression this is an example to help me learn how to edit and add data to layers.