cschwind_erg

ArcGIS Online overwriting maxScale

Discussion created by cschwind_erg on Apr 7, 2020

I wrote some JavaScript code to save a client side feature layer to a feature service on ArcGIS Online. I'm running into an issue where if I navigate to the layer from ArcGIS Online, it overwrites my minScale and maxScale values. This causes my graphics to not always show up when the map viewer loads or the graphics disappear if the user zooms in (most graphics are on a building level of scale). I want the minScale and maxScale values set to 0, so the graphics are always visible and the user doesn't have to change the visibility range. 

 

I'm using the addToDefinition REST service (Add to Definition (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers) for saving the layer to the feature service. When I make this call I'm setting the maxScale and minScale to 0. I've included the JSON that I'm passing in to the addToDefinition call below.

 

If I navigate to the layer via a url formatted like https://services5.arcgis.com/<owner id>/arcgis/rest/services/<feature server name>/FeatureServer/<layer id>?token=<token>, I can see that minScale and maxScale are 0 as expected.

 

If I navigate to the layer through ArcGIS Online, the minScale and maxScale get overwritten. The screenshot below shows that an updateDefinition call is being made on my layer, which sets the maxScale to 564 and the minScale to 4514.

 

I have noticed that I can make a updateDefinition (Update Definition (Feature Layer)—ArcGIS REST API: Services Directory | ArcGIS for Developers ) call to the layer and reset minScale and maxScale back to 0. I have noticed that if I visit ArcGIS Online and then make the call to updateDefinition, my minScale and maxScale values will stay 0. So it seems like I'm missing some setting on the layer, that triggers ArcGIS online to update minScale and maxScale.

 

Is there a setting that I can set in the addToDefinition call (or elsewhere) that will prevent ArcGIS Online from overwriting my minScale and maxScale settings?

 

 

addToDefinition: {
    "layers": [{
        "type": "Feature Layer",
        "editFieldsInfo": {
            "creationDateField": "CreationDate",
            "creatorField": "Creator",
            "editDateField": "EditDate",
            "editorField": "Editor"
        },
        "editingInfo": {
            "lastEditDate": 1455126059440
        },
        "geometryType": "esriGeometryPolygon",
        "maxScale": 0,
        "allowGeometryUpdates": true,
        "hasAttachments": false,
        "htmlPopupType": "esriServerHTMLPopupTypeNone",
        "hasM": false,
        "hasZ": false,
        "objectIdField": "OBJECTID",
        "globalIdField": "GlobalID",
        "fields": [{
            "name": "OBJECTID",
            "type": "esriFieldTypeOID",
            "actualType": "int",
            "alias": "OBJECTID",
            "sqlType": "sqlTypeInteger",
            "length": 4,
            "nullable": false,
            "editable": false,
            "domain": null,
            "defaultValue": null
        }, {
            "name": "PERMANENT_IDENTIFIER",
            "type": "esriFieldTypeGUID",
            "alias": "PERMANENT_IDENTIFIER",
            "sqlType": "sqlTypeOther",
            "length": 38,
            "nullable": false,
            "editable": true,
            "domain": null,
            "defaultValue": "NEWID() WITH VALUES"
        }, {
            "name": "GlobalID",
            "type": "esriFieldTypeGlobalID",
            "alias": "GlobalID",
            "sqlType": "sqlTypeOther",
            "length": 38,
            "nullable": false,
            "editable": false,
            "domain": null,
            "defaultValue": "NEWID() WITH VALUES"
        }
        ],
        "supportedQueryFormats": "JSON",
        "hasStaticData": false,
        "maxRecordCount": 1000,
        "standardMaxRecordCount": 4000,
        "tileMaxRecordCount": 4000,
        "maxRecordCountFactor": 1,
        "capabilities": "Create,Delete,Query,Update,Editing,Extract,Sync",
        "exceedsLimitFactor": 1,
        "name": "Scenario18_Testing",
        "description": "jklj",
        "extent": {
            "spatialReference": {
                "latestWkid": 3857,
                "wkid": 102100
        },
        "xmin": -8815056.763641614,
        "ymin": 4604215.222325314,
        "xmax": -8815041.647920694,
        "ymax": 4604232.558750913
        },
    "minScale": 0
    }
    ]
}

Outcomes