2

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.

asked May 17, 2019 at 9:16
1
  • Please place the relevant code sample in the body of the question using a code block. Third-party links fail over time, which invalidates the question content. Commented May 17, 2019 at 10:43

1 Answer 1

1

You can skip the query and use definitionExpression if you want to filter the displayed data. Here's a working example - based on your code.

answered Jun 22, 2019 at 10:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.