LayerToggleButton - layer name and config itemid correspondance

197
1
Jump to solution
09-01-2021 10:40 AM
Labels (2)
Rémy_Gourrat
New Contributor II

Hi,

I'am very happy to get LayerToggleButton, it's exactly that i want with 3 buttons i can change state of my 50 layers by only one click on the specific button.

Now, i must parameter layers to display, it's fastidiouis and i'm afraid to make some mistakes.

i had parameted in ArcGIS Pro some tasks to display this layers, so after execute the display task, in python i can easely extract the name and the source of layer "...myfeaturelayer/[Layerid]."

But how to convert this datas in something seems to be an itemid to put in my LayerToggleButton/config_widgets_LayerToggleButton_Widget_2.json ?

{
  "layerOptions": {
    "17ba151e4b3-layer-61": {
      "display": false
    },
    "17ba151e4b1-layer-60": {
      "display": false
    },
    "17ba151e4b0-layer-59": {
      "display": false
    },
    "17ba151e4ae-layer-58": {
      "display": false
    },
    "7671009ee30449f9be968df5cb1e5614": {
      "display": true
    },
    "5e94a2e374734352ac62ef4c66e94703": {
      "display": true
    }
  },
  "zoomTo": false,
  "isExclusive": true
}

thanks for your help

Rémy

0 Kudos
1 Solution

Accepted Solutions
Rémy_Gourrat
New Contributor II

Hi, 

i get the answered to my question !

the id referenced in the config_widgets_LayerToggleButton_Widget_[X].json is the id of the layer in the webmap json definition (first line).

so now i must just play with python to get layername and id in the webmap...

...
{
	"id": "3f9c912ecf2246deafb46a7cc3e7d036",
	"title": "my namelayer",
	"visibility": false,
	"layers": [
		{
			"id": "a1f1ebaff6e04144ac3bd948fbd395c5",
			"showLegend": true,
			"disablePopup": false,
			"title": "namelayer_in_feature_layer",
			"url": "https://mydomain.com/arcgis/rest/services/myfeaturelayer_WFL1/FeatureServer/1",
			"itemId": "e5a4fca21b3b4805a182071d59c7db6f",
			"layerType": "ArcGISFeatureLayer",
			"popupInfo": {
				"popupElements": [
					{
...

 

View solution in original post

0 Kudos
1 Reply
Rémy_Gourrat
New Contributor II

Hi, 

i get the answered to my question !

the id referenced in the config_widgets_LayerToggleButton_Widget_[X].json is the id of the layer in the webmap json definition (first line).

so now i must just play with python to get layername and id in the webmap...

...
{
	"id": "3f9c912ecf2246deafb46a7cc3e7d036",
	"title": "my namelayer",
	"visibility": false,
	"layers": [
		{
			"id": "a1f1ebaff6e04144ac3bd948fbd395c5",
			"showLegend": true,
			"disablePopup": false,
			"title": "namelayer_in_feature_layer",
			"url": "https://mydomain.com/arcgis/rest/services/myfeaturelayer_WFL1/FeatureServer/1",
			"itemId": "e5a4fca21b3b4805a182071d59c7db6f",
			"layerType": "ArcGISFeatureLayer",
			"popupInfo": {
				"popupElements": [
					{
...

 

View solution in original post

0 Kudos