How to use code to turn on a feature layer when a specific marker layer has been selected?

Hi all,

I am trying to set up some IronPython code that adds and turns on a feature layer only when a specific marker layer has been selected by the user. My code is below. Error traceback says that the file for the new feature layer has not been found. I have checked the file name and it is correct, so I must have something else wrong in the code. Any help will be much appreciated!

Thank you! 

Lauren

 

## set visualiation as map chart

map = visualization.As[MapChart]()

## add new feature layer

fl=map.Layers.AddNewFeatureLayer("RR43")

## give new layer a title

fl[0].Title="RR43"

## if the title of the marker layer the user has selected is "FB" then turn on the new feature layer "RR43" also

if (layer.Title == "FB"):

    fl[0].Enabled=True

 

1 Comment

Just solved it!

for layer in map.Layers:

    if layer.Title == "RR43":

        fLayer = layer

for layer in map.Layers:

    if layer.Title == "FB":

       fLayer.Enabled = True

lauren.fuller - Jul 19, 2019 - 6:45am
+ Add a Comment

(1) Answer

Login