I am using arcgis 3.23. I have defined the following SimpleLineSymbol to use to highlight selected features in different FeatureLayers.

              app.selectionLineSymbol = new SimpleLineSymbol();
              app.selectionLineSymbol.setColor(new Color([255, 255, 255, 0.60]));   

The layers in question are defined as follows

      var blazeColorsTa = new FeatureLayer(app.blazeColorsTaUrl, {
          id: "blazeColorsTa",
          outFields: ["*"]

      var longTrails = new FeatureLayer(app.longTrailsUrl, {
          id: "longTrails",
          outFields: ["*"]

I use the following code to highlight selected features from the blazeColorsTa layer and the selected features show through the selection symbol as desired.

                var blazeColorLayer = app.map.getLayer("blazeColorsTa");

However, when I use identical code to highlight selected features from the longTrails layer the selected features are hidden by the selection symbol.

                var longTrailLayer = app.map.getLayer("longTrails");

I assume the problem has to do with a difference in how the layers are created in the GIS service but the only difference I can see is the longTrails layer is has both the Min Scale and Max Scale set to 0. Where should I look to see what is causing the issue?


Here is what the trail looks like before selection:

No Selection

Here is what it should look like after selection. I changed the color to light green so you could see it better. The selection symbol works when it is called by the popup. It also looks like this when I use my selection code on the blazeColorsTa layer.

Correct Selection

Here is what it looks like when I call it with the code I listed above on the longTrails layer where the feature is hidden by the selection symbol.

Incorrect Selection

Just in case it is helpful, here is the code which defines the popup mentioned earlier.

            popup = new Popup({
                  lineSymbol: app.selectionLineSymbol,
                  visibleWhenEmpty: false,
                  hideDelay: 0,
                  zoomFactor: 1,
                  keepHighlightOnHide: true
              }, domConstruct.create("div"));

I had to make a custom zoom for the popup and I use the selection code to highlight the feature I have zoomed to.

  • What do you mean the features are hidden by the selection symbol? Can you post images of the layers with and without the highlighted features? – kenbuja Jun 22 '18 at 18:38
  • Hi ponder275, I'm wondering that what you need is adding a graphic over a specific feature, instead of select the feature itself. What is the goal of your code? Do something with the selected feature or just highlight it to help the user? – Katah Jun 25 '18 at 7:03
  • When the user clicks on a trail (which may be more than one feature), a popup box appears with trail information. When they click on zoom, I zoom to the extent of the trail (again, it may be more than one feature) and need to mark the trail as being selected. The layer.selectFeatures(...) works for all of the other layers. If there is a better way to accomplish my goal I will be happy to change to the better way. – ponder275 Jun 25 '18 at 13:28
  • I also need to do the same thing with a ArcGISDynamicMapServiceLayer layer. Can I accomplish that by using QueryTask and then adding the selectionLineSymbol to each of the features returned by the QueryTask? – ponder275 Jun 25 '18 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.