Description
In some instances, when configuring pop-ups and adding custom expressions using the ArcGIS Arcade geometry function to display Z-values in ArcGIS Online Map Viewer or ArcGIS Online Map Viewer Classic pop-ups, a null value is returned.
The following image shows an example of a null value returned when using the Arcade expression in ArcGIS Online Map Viewer.
The following image shows an example of a null value returned when using the Arcade expression in ArcGIS Online Map Viewer Classic.
Cause
- Z-values are not enabled in the data.
- A known limitation with Arcade expressions in ArcGIS Online Map Viewer Classic. This issue is logged by Esri as a defect. Refer to BUG-000119441 for more information.
Solution or Workaround
Use one of the methods below to resolve the issue.
Enable Z-values on the existing data in ArcGIS Pro
- In ArcGIS Pro, add the layer to a new project.
- Right-click the feature layer in the Contents pane, and click Data > Export Table.
- In the Export Table window, select the desired feature layer for Input Rows, and fill in the name for Output Name. Click OK.
- Right-click the newly exported table, and click Display XY Data.
- In the Display XY Data window, select the table for Input Table and the field for Z Field. Retain the default parameters for others if no changes are to be made.
- Click OK. A new feature layer is created with the z-values enabled.
- In the Contents pane, right-click the new layer, and click Sharing > Share As Web Layer.
- In the Share As Web Layer pane, click General, and fill in the required fields. Click Publish.
- In ArcGIS Online Map Viewer, configure pop-ups of the Z-enabled hosted feature layer to display Z values using the ArcGIS Arcade geometry function.
Use ArcGIS Online Map Viewer instead of ArcGIS Online Map Viewer Classic
- Log in to the ArcGIS Online organizational account.
- Click Content, and click the My Content tab. Select the layer or web map to open in Map Viewer.
- In ArcGIS Online Map Viewer, on the Settings toolbar, click Configure pop-ups.
- In the pop-up configuration pane, click the drop-down arrow, and select the desired feature layer.
- Click Manage expressions > Add expression.
- In the Expression window, fill in the following expression:
Geometry($feature).z
- Click Test, and click OK.
- Set the custom expression as the displayed field in the pop-up. The image below shows the Z value is displayed in the pop-up using the custom expression.
Use the Add Z Information tool in ArcGIS Pro
Note:
The 3D Analyst extension is required for the tool and workflow described. Ensure the Z-values are set before proceeding the following workflow.
- In ArcGIS Pro, add the feature layer to a new project.
- On the top ribbon, click the Analysis tab > Tools.
- In the Geoprocessing pane, search for and select Add Z Information (3D Analyst).
- In the Add Z Information pane, click the Parameters tab.
- Select the layer for Input Features, and check the Spot Z check box for Output Property.
- Click Run. A new Z field is created.
- Publish the layer to ArcGIS Online, open it in Map Viewer, and configure the pop-ups of the layer to display the new Z field. Refer to ArcGIS Online: Configure pop-ups for more information.