laptop and a wrench

不具合

Calculate operation fails with "The calculate expression is not valid" error when validating SQL expression to update date fields in hosted feature services.

Portal for ArcGIS
不具合 ID 番号 BUG-000161055
送信されましたAugust 30, 2023
最終更新日June 5, 2024
適用対象Portal for ArcGIS
見つかったバージョン10.8.1
オペレーティング システムWindows Server
オペレーティング システムのバージョン2016 64 Bit
修正されたバージョン10.9
ステータスFixed

対処法

There are two workarounds for this defect.

 

1) Upgrade the ArcGIS Enterprise deployment to versions 10.9.1, 11.0, or 11.1.

2) Use the Python script below to update the date field of a hosted feature layer.

 

# import modules

# Python modules

import datetime as dt

import pandas as pd

 

# ArcGIS modules

from arcgis.gis import GIS

from arcgis.features import GeoAccessor, GeoSeriesAccessor

 

# establish a connection to the portal

gis = GIS("portal url", "username", "password")

 

# access to the hosted feature service / feature layer collection

feature_layer_collection = gis.content.get("item id")

 

# access to feature layer that has date field

feature_layer = feature_layer_collection.layers[0]

 

# convert feature layer to spatially enabled dataframe

sedf = pd.DataFrame.spatial.from_layer(layer=feature_layer)

 

# convert the UTC time zone to Pacific Time Zone using Pandas functions

sedf['DateField'] = sedf['DateField'].dt.tz_localize('utc').dt.tz_convert('US/Pacific')

 

# update the date field in the spatially enabled dataframe

sedf['DateField'] = sedf['DateField'] + pd.Timedelta(hours=1)

# remove localization from the date field

sedf['DateField'] = pd.to_datetime(sedf['DateField']).dt.tz_localize(None)

                                       

# convert spatially enabled dataframe to a feature set

feature_set = sedf.spatial.to_featureset()

 

# update feature layer using the feature set with edit_features method

feature_layer.edit_features(updates = feature_set)

 

The Python script above increases one hour to the time of the date field in a hosted feature layer. This value can be varied for different workflows. 

再現の手順

不具合 ID: BUG-000161055

ソフトウェア:

  • Portal for ArcGIS

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動