Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialState property not added to webmap.definition or get_data() when the ArcGIS API for Python is used to create a WebMap #1742

Open
Clubdebambos opened this issue Jan 15, 2024 · 2 comments
Assignees
Labels

Comments

@Clubdebambos
Copy link

Clubdebambos commented Jan 15, 2024

Describe the bug
Workflow relates to new Map Viewer (not the classic)

I have created a WebMap using the ArcGIS API for Python WebMap class and saving as a new WebMap with the save() method.

I have performed several other tasks using the API such as adding layers and tables, updating symbology, opacity, visibility etc. With each task I check the WebMap definition via the definition property for a WebMap object and also with the get_data() approach, neither of which return an initialState property. The initialState property is required to alter the extent of the WebMap upon opening. The only way to get the initialState property is to manually open the WebMap and perform a save, which defeats the purpose of the automation.

To Reproduce
Steps to reproduce the behavior:

from arcgis.gis import GIS
from arcgis.mapping import WebMap

## Access AGOL
agol = GIS("home")

## Instantiate a WebMap object
webmap = WebMap()

## Set the Basemap
webmap.basemap = "gray-vector"

## WebMap Item Properties
wm_item_dict = {
    "title" : "API_Python_WebMap",
    "snippet" : "Python injected snippet",
    "description" : "Python injected description",
    "tags" : "python,injected,tags", # ["python", "injected", "tags"]
    "extent" : {'xmin': -9.1, 'ymin': 53.255, 'xmax': -9.0, 'ymax': 53.3, 'spatialReference': {'wkid': 4326}}, 
}

## Save the WebMap to AGOL 
wm_item = webmap.save(item_properties=wm_item_dict)

You can use the API to add layer and tables and update the WebMap object. Then access the WebMap deefinition

## get webmap item
wm_item = agol.content.get("WM_ITEM_ID")

## Create a WebMap object from WebMap Item
webmap = WebMap(wm_item)

## print the definition
print(webmap.definition

error:

Check out below, no initialState.

{
  "operationalLayers": [
    {
      "title": "NPWS_BIO_NHA_Ply",
      "opacity": 1,
      "visibility": true,
      "id": "1594bac3-7508-492b-9537-84bdacaec08b",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                76,
                129,
                205,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSSolid",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75
              }
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/0",
      "popupInfo": {
        "title": "NPWS_BIO_NHA_Ply",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "label": "SITECODE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "label": "SITE_NAME",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "label": "Shape__Area",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "label": "Shape__Length",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    },
    {
      "title": "NPWS_BIO_pNHA_Ply",
      "opacity": 1,
      "visibility": true,
      "id": "8abad6c6-f2d9-4786-a47d-fde7b6937662",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                252,
                225,
                56,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSSolid",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75
              }
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/1",
      "popupInfo": {
        "title": "NPWS_BIO_pNHA_Ply",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "label": "SITECODE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "label": "SITE_NAME",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "label": "Shape__Area",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "label": "Shape__Length",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    },
    {
      "title": "NPWS_BIO_SAC_Ply",
      "opacity": 1,
      "visibility": true,
      "id": "38f2da25-a98d-43a6-9949-5d678e3a7c55",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                72,
                136,
                92,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSSolid",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75
              }
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/2",
      "popupInfo": {
        "title": "NPWS_BIO_SAC_Ply",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "label": "SITECODE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "label": "SITE_NAME",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "label": "Shape__Area",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "label": "Shape__Length",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    },
    {
      "title": "NPWS_BIO_SPA_Ply",
      "opacity": 1,
      "visibility": true,
      "id": "a0445d54-ea92-4456-b701-8769ee29080c",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                252,
                62,
                90,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSSolid",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75
              }
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/3",
      "popupInfo": {
        "title": "NPWS_BIO_SPA_Ply",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "label": "SITECODE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "label": "SITE_NAME",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "label": "Shape__Area",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "label": "Shape__Length",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    },
    {
      "title": "NIAH Locations",
      "opacity": 1,
      "visibility": true,
      "id": "5212684c-4ef5-4877-b977-f4ac57a8a440",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriPMS",
              "url": "RedSphere.png",
              "imageData": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7DAAA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GGLAk8z5XiaJUd99u8122/IpBA2K9BGg2vWWKAvRYVeLzEa7E1R422m2+MsSTem97nSYnfKyN6/mzATv7AUgqcMrUnmaFlLX3ysM0fj+t/b5lQLtK22QEfyAmiSLKFZpUJ7kBRPXKW4HqCYynWVHKSG2LkyZex1uO1mZM9lKem9Tx9jjY5iNEYo0bKMhn7ZAu0r6H5PpLXCAq0rKJClSjSGynE/QIkrQYqBPe6S2X+AJsY2Ped6iWZk6RlL0c2r5szofRsO9R5S1IfQLRCpQL1aifoYFerpsbkuTImaUJXuXIDiH6/Ys8vm3Mg8L2i20YqsO7fItKLcSXyn0kXccclVqv3MS6at9JU/Ox+ouns+SF6Z4cSupz7l8+z1ucs7LF1AQjOdxfGZzmx8Iu1TRcfnrioICAQEAgIBgYBAQCAgEBAICAQEAgIBgYBAQCAgEBAICAQEAv8H44b/6ZiGvGAAAAAASUVORK5CYII=",
              "contentType": "image/png",
              "width": 15,
              "height": 15
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "6f09b28958b8444fb657e4facbb8f6a6",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NIAH Locations/FeatureServer/0",
      "popupInfo": {
        "title": "NIAH Locations",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "REG_NO",
            "label": "REG_NO",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Date_Field",
            "label": "Date_Field",
            "isEditable": true,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    },
    {
      "title": "County Boundaries",
      "opacity": 1,
      "visibility": true,
      "id": "22cd7f0b-e898-4327-8df1-dafb56dbf095",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                76,
                129,
                205,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSSolid",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75
              }
            }
          }
        }
      },
      "layerType": "ArcGISFeatureLayer",
      "itemId": "02203f2ea1db4bd387b5e01638e1c33f",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/County Boundaries/FeatureServer/0",
      "popupInfo": {
        "title": "County Boundaries",
        "fieldInfos": [
          {
            "fieldName": "FID",
            "label": "FID",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "COUNTY",
            "label": "COUNTY",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "PROVINCE",
            "label": "PROVINCE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape_Leng",
            "label": "Shape_Leng",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape_Area",
            "label": "Shape_Area",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "label": "Shape__Area",
            "isEditable": false,
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "label": "Shape__Length",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    }
  ],
  "baseMap": {
    "baseMapLayers": [
      {
        "id": "gray-base-layer",
        "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/291da5eab3a0412593b66d384379f89f/resources/styles/root.json",
        "layerType": "VectorTileLayer",
        "title": "Light Gray Base",
        "visibility": true,
        "opacity": 1
      },
      {
        "id": "gray-reference-layer",
        "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/1768e8369a214dfab4e2167d5c5f2454/resources/styles/root.json",
        "layerType": "VectorTileLayer",
        "title": "Light Gray Reference",
        "isReference": true,
        "visibility": true,
        "opacity": 1
      }
    ],
    "title": "Gray Vector"
  },
  "spatialReference": {
    "wkid": 102100,
    "latestWkid": 3857
  },
  "version": "2.10",
  "authoringApp": "ArcGISPythonAPI",
  "authoringAppVersion": "2.2.0.1",
  "tables": [
    {
      "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV",
      "opacity": 1,
      "visibility": true,
      "id": "85233801-6d73-46a3-a171-364a63af4e4b",
      "layerDefinition": {
        "definitionExpression": null
      },
      "itemId": "6f09b28958b8444fb657e4facbb8f6a6",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NIAH Locations/FeatureServer/1",
      "popupInfo": {
        "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV",
        "fieldInfos": [
          {
            "fieldName": "REG_NO",
            "label": "REG_NO",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "ORIGINAL_TYPE",
            "label": "ORIGINAL_TYPE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "IN_USE_AS_TYPE",
            "label": "IN_USE_AS_TYPE",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "NAME",
            "label": "NAME",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "COUNTY",
            "label": "COUNTY",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "DATEFROM",
            "label": "DATEFROM",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "DATETO",
            "label": "DATETO",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "RATING",
            "label": "RATING",
            "isEditable": true,
            "visible": true
          },
          {
            "fieldName": "ObjectId",
            "label": "ObjectId",
            "isEditable": false,
            "visible": true
          }
        ],
        "description": null,
        "showAttachments": true,
        "mediaInfos": []
      }
    }
  ]

BUT when I open and save the WebMap manually and reprint...

{
  "operationalLayers": [
    {
      "id": "1594bac3-7508-492b-9537-84bdacaec08b",
      "opacity": 1,
      "title": "NPWS_BIO_NHA_Ply",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/0",
      "visibility": true,
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "color": [
                76,
                129,
                205,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              },
              "style": "esriSFSSolid"
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "isEditable": true,
            "label": "SITECODE",
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "isEditable": true,
            "label": "SITE_NAME",
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "isEditable": false,
            "label": "Shape__Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "isEditable": false,
            "label": "Shape__Length",
            "visible": true
          }
        ],
        "title": "NPWS_BIO_NHA_Ply"
      }
    },
    {
      "id": "8abad6c6-f2d9-4786-a47d-fde7b6937662",
      "opacity": 1,
      "title": "NPWS_BIO_pNHA_Ply",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/1",
      "visibility": true,
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "color": [
                252,
                225,
                56,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              },
              "style": "esriSFSSolid"
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "isEditable": true,
            "label": "SITECODE",
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "isEditable": true,
            "label": "SITE_NAME",
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "isEditable": false,
            "label": "Shape__Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "isEditable": false,
            "label": "Shape__Length",
            "visible": true
          }
        ],
        "title": "NPWS_BIO_pNHA_Ply"
      }
    },
    {
      "id": "38f2da25-a98d-43a6-9949-5d678e3a7c55",
      "opacity": 1,
      "title": "NPWS_BIO_SAC_Ply",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/2",
      "visibility": true,
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "color": [
                72,
                136,
                92,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              },
              "style": "esriSFSSolid"
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "isEditable": true,
            "label": "SITECODE",
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "isEditable": true,
            "label": "SITE_NAME",
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "isEditable": false,
            "label": "Shape__Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "isEditable": false,
            "label": "Shape__Length",
            "visible": true
          }
        ],
        "title": "NPWS_BIO_SAC_Ply"
      }
    },
    {
      "id": "a0445d54-ea92-4456-b701-8769ee29080c",
      "opacity": 1,
      "title": "NPWS_BIO_SPA_Ply",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NPWS/FeatureServer/3",
      "visibility": true,
      "itemId": "1f09af64878b4696bad258a1d651bd7f",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "color": [
                252,
                62,
                90,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              },
              "style": "esriSFSSolid"
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "SITECODE",
            "isEditable": true,
            "label": "SITECODE",
            "visible": true
          },
          {
            "fieldName": "SITE_NAME",
            "isEditable": true,
            "label": "SITE_NAME",
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "isEditable": false,
            "label": "Shape__Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "isEditable": false,
            "label": "Shape__Length",
            "visible": true
          }
        ],
        "title": "NPWS_BIO_SPA_Ply"
      }
    },
    {
      "id": "5212684c-4ef5-4877-b977-f4ac57a8a440",
      "opacity": 1,
      "title": "NIAH Locations",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NIAH Locations/FeatureServer/0",
      "visibility": true,
      "itemId": "6f09b28958b8444fb657e4facbb8f6a6",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriPMS",
              "angle": 0,
              "xoffset": 0,
              "yoffset": 0,
              "contentType": "image/png",
              "imageData": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xTuc4+QAAB3VJREFUeF7tmPlTlEcexnve94U5mANQbgQSbgiHXHINlxpRIBpRI6wHorLERUmIisKCQWM8cqigESVQS1Kx1piNi4mW2YpbcZONrilE140RCTcy3DDAcL/zbJP8CYPDL+9Ufau7uqb7eZ7P+/a8PS8hwkcgIBAQCAgEBAICAYGAQEAgIBAQCAgEBAICAYGAQEAgIBAQCDx/AoowKXFMUhD3lQrioZaQRVRS+fxl51eBTZUTdZ41U1Rox13/0JF9csGJ05Qv4jSz/YPWohtvLmSKN5iTGGqTm1+rc6weICOBRbZs1UVnrv87T1PUeovxyNsUP9P6n5cpHtCxu24cbrmwKLdj+osWiqrVKhI0xzbmZ7m1SpJ+1pFpvE2DPvGTomOxAoNLLKGLscZYvB10cbYYjrJCb7A5mrxleOBqim+cWJRakZY0JfnD/LieI9V1MrKtwokbrAtU4Vm0A3TJnphJD4B+RxD0u0LA7w7FTE4oprOCMbklEGNrfdGf4IqnQTb4wc0MFTYibZqM7JgjO8ZdJkpMln/sKu16pHZGb7IfptIWg389DPp9kcChWODoMuDdBOhL1JgpisbUvghM7AqFbtNiaFP80RLnhbuBdqi0N+1dbUpWGde9gWpuhFi95yL7sS7BA93JAb+Fn8mh4QujgPeTgb9kAZf3Apd2A+fXQ38yHjOHozB1IAJjOSEY2RSIwVUv4dd4X9wJccGHNrJ7CYQ4GGjLeNNfM+dyvgpzQstKf3pbB2A6m97uBRE0/Ergcxr8hyqg7hrwn0vAtRIKIRX6Y2pMl0RhI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zEVqXSNC2awE69lqhs8AamkO26HrbDt2H7dBVQov2NcW26CiwQtu+BWjdY4n2nZboTbfCmKcCnRyDO/YmyLPnDlHvjDH8G6zhS9/wlEnYR7X00fWrFYuWdVI0ZpuhcbcczW/R2qdAcz6t/bRov4mONeaaoYl+p22rHF0bVNAmKtBvweIXGxNcfFH8eNlC4m6wMWMusEnKpn5hyo48pj9gLe4SNG9QoGGLAk8z5XiaJUd99u8122/IpBA2K9BGg2vWWKAvRYVeLzEa7E1R422m2+MsSTem97nSYnfKyN6/mzATv7AUgqcMrUnmaFlLX3ysM0fj+t/b5lQLtK22QEfyAmiSLKFZpUJ7kBRPXKW4HqCYynWVHKSG2LkyZex1uO1mZM9lKem9Tx9jjY5iNEYo0bKMhn7ZAu0r6H5PpLXCAq0rKJClSjSGynE/QIkrQYqBPe6S2X+AJsY2Ped6iWZk6RlL0c2r5szofRsO9R5S1IfQLRCpQL1aifoYFerpsbkuTImaUJXuXIDiH6/Ys8vm3Mg8L2i20YqsO7fItKLcSXyn0kXccclVqv3MS6at9JU/Ox+ouns+SF6Z4cSupz7l8+z1ucs7LF1AQjOdxfGZzmx8Iu1TRcfnrioICAQEAgIBgYBAQCAgEBAICAQEAgIBgYBAQCAgEBAICAQEAv8H44b/6ZiGvGAAAAAASUVORK5CYII=",
              "url": "./RedSphere.png",
              "height": 15,
              "width": 15
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "REG_NO",
            "isEditable": true,
            "label": "REG_NO",
            "visible": true
          },
          {
            "fieldName": "Date_Field",
            "isEditable": true,
            "label": "Date_Field",
            "visible": true
          }
        ],
        "title": "NIAH Locations"
      }
    },
    {
      "id": "22cd7f0b-e898-4327-8df1-dafb56dbf095",
      "opacity": 1,
      "title": "County Boundaries",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/County Boundaries/FeatureServer/0",
      "visibility": true,
      "itemId": "02203f2ea1db4bd387b5e01638e1c33f",
      "layerType": "ArcGISFeatureLayer",
      "layerDefinition": {
        "definitionExpression": null,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "color": [
                76,
                129,
                205,
                191
              ],
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              },
              "style": "esriSFSSolid"
            }
          }
        }
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "FID",
            "isEditable": false,
            "label": "FID",
            "visible": true
          },
          {
            "fieldName": "COUNTY",
            "isEditable": true,
            "label": "COUNTY",
            "visible": true
          },
          {
            "fieldName": "PROVINCE",
            "isEditable": true,
            "label": "PROVINCE",
            "visible": true
          },
          {
            "fieldName": "Shape_Leng",
            "isEditable": true,
            "label": "Shape_Leng",
            "visible": true
          },
          {
            "fieldName": "Shape_Area",
            "isEditable": true,
            "label": "Shape_Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Area",
            "isEditable": false,
            "label": "Shape__Area",
            "visible": true
          },
          {
            "fieldName": "Shape__Length",
            "isEditable": false,
            "label": "Shape__Length",
            "visible": true
          }
        ],
        "title": "County Boundaries"
      }
    }
  ],
  "tables": [
    {
      "id": "85233801-6d73-46a3-a171-364a63af4e4b",
      "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NIAH Locations/FeatureServer/1",
      "visibility": true,
      "itemId": "6f09b28958b8444fb657e4facbb8f6a6",
      "layerDefinition": {
        "definitionExpression": null
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "REG_NO",
            "isEditable": true,
            "label": "REG_NO",
            "visible": true
          },
          {
            "fieldName": "ORIGINAL_TYPE",
            "isEditable": true,
            "label": "ORIGINAL_TYPE",
            "visible": true
          },
          {
            "fieldName": "IN_USE_AS_TYPE",
            "isEditable": true,
            "label": "IN_USE_AS_TYPE",
            "visible": true
          },
          {
            "fieldName": "NAME",
            "isEditable": true,
            "label": "NAME",
            "visible": true
          },
          {
            "fieldName": "COUNTY",
            "isEditable": true,
            "label": "COUNTY",
            "visible": true
          },
          {
            "fieldName": "DATEFROM",
            "isEditable": true,
            "label": "DATEFROM",
            "visible": true
          },
          {
            "fieldName": "DATETO",
            "isEditable": true,
            "label": "DATETO",
            "visible": true
          },
          {
            "fieldName": "RATING",
            "isEditable": true,
            "label": "RATING",
            "visible": true
          },
          {
            "fieldName": "ObjectId",
            "isEditable": false,
            "label": "ObjectId",
            "visible": true
          }
        ],
        "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV"
      }
    },
    {
      "id": "0324a0de-c577-4538-bd67-db7733168d7e",
      "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV",
      "url": "https://services-eu1.arcgis.com/xImpnbbhc3YDkwTJ/arcgis/rest/services/NIAH Locations/FeatureServer/1",
      "visibility": true,
      "itemId": "6f09b28958b8444fb657e4facbb8f6a6",
      "layerDefinition": {
        "definitionExpression": null
      },
      "popupInfo": {
        "popupElements": [
          {
            "type": "fields"
          },
          {
            "type": "attachments",
            "displayType": "auto"
          }
        ],
        "showAttachments": true,
        "fieldInfos": [
          {
            "fieldName": "REG_NO",
            "isEditable": true,
            "label": "REG_NO",
            "visible": true
          },
          {
            "fieldName": "ORIGINAL_TYPE",
            "isEditable": true,
            "label": "ORIGINAL_TYPE",
            "visible": true
          },
          {
            "fieldName": "IN_USE_AS_TYPE",
            "isEditable": true,
            "label": "IN_USE_AS_TYPE",
            "visible": true
          },
          {
            "fieldName": "NAME",
            "isEditable": true,
            "label": "NAME",
            "visible": true
          },
          {
            "fieldName": "COUNTY",
            "isEditable": true,
            "label": "COUNTY",
            "visible": true
          },
          {
            "fieldName": "DATEFROM",
            "isEditable": true,
            "label": "DATEFROM",
            "visible": true
          },
          {
            "fieldName": "DATETO",
            "isEditable": true,
            "label": "DATETO",
            "visible": true
          },
          {
            "fieldName": "RATING",
            "isEditable": true,
            "label": "RATING",
            "visible": true
          },
          {
            "fieldName": "ObjectId",
            "isEditable": false,
            "label": "ObjectId",
            "visible": true
          }
        ],
        "title": "ARCGISAFP03_DHLGH_HER_NIAH_CSV"
      }
    }
  ],
  "baseMap": {
    "baseMapLayers": [
      {
        "id": "gray-base-layer",
        "opacity": 1,
        "title": "Light Gray Base",
        "visibility": true,
        "layerType": "VectorTileLayer",
        "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/291da5eab3a0412593b66d384379f89f/resources/styles/root.json"
      },
      {
        "id": "gray-reference-layer",
        "opacity": 1,
        "title": "Light Gray Reference",
        "visibility": true,
        "layerType": "VectorTileLayer",
        "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/1768e8369a214dfab4e2167d5c5f2454/resources/styles/root.json",
        "isReference": true
      }
    ],
    "title": "Gray Vector"
  },
  "authoringApp": "ArcGISMapViewer",
  "authoringAppVersion": "2023.2",
  "initialState": {
    "viewpoint": {
      "targetGeometry": {
        "spatialReference": {
          "latestWkid": 3857,
          "wkid": 102100
        },
        "xmin": -1014373.2746817113,
        "ymin": 7029493.032344548,
        "xmax": -1000509.5086765061,
        "ymax": 7039496.7284213565
      }
    }
  },
  "spatialReference": {
    "latestWkid": 3857,
    "wkid": 102100
  },
  "timeZone": "system",
  "version": "2.29",
  "widgets": {
    "timeSlider": {
      "properties": {
        "endTime": 1703721660000,
        "startTime": 1672531200000,
        "loop": true,
        "numberOfStops": 10,
        "thumbCount": 2,
        "thumbMovingRate": 2000
      }
    }
  }
}

I also notice that the timeSlider widget is not present in the first JSON printout even though a layer added using the API has time enabled. When I open the WebMap the time slider is there, but it takes a manual save for it to appear in the definition.

Screenshots
If applicable, add screenshots to help explain your problem.

Expected behavior
A clear and concise description of what you expected to happen.

Platform (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Python API Version: 2.2.0.1

Additional context
initialState controls the default view, cannot update extent without its presence in the definition.

@nanaeaubry
Copy link
Contributor

@Clubdebambos
Some of these changes are being applied in the new mapping module implementation.

The reason this is occurring is because some properties (such as initial state) depend on a rendered map in the current implementation. The initial state is created on the Javascript side and not through the python side. We are working on changing this and relying more on python to initialize as much as we can.

Thanks for pointing out the time slider issue. I will test this on the new implementation and make sure the expected behavior is present

@nanaeaubry nanaeaubry self-assigned this Jan 16, 2024
@nanaeaubry
Copy link
Contributor

@Clubdebambos I've looked into this more and the time slider widget can only be created if the map is rendered either inside a jupyter notebook (in future a lab) or the GUI (i.e. map viewer).
This is because it is created with Javascript code and JS needs a browser to run. Any sort of widget will have this limitation since it is Javascript backend that we are calling.

We are working on a python implementation of the webmap but not of the individual widgets at this point so we don't plan on having this work without the map being rendered.

Initial state is part of the webmap definition so this will be handled in the new python implementation of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants