Select to view content in your preferred language

Enhance Survey123 Geoshape to allow multipart geometry

459
3
06-24-2025 07:15 PM
Status: Open
Labels (3)
MarkWILSON_LLS
Regular Contributor

Please consider upgrading the geoshape geometry functionality to include multipart polygon features. 

Id like to see the ability to pass multipart geometry using pulldata('json ') into a geoshape field.

 

Tags (3)
3 Comments
MarkWILSON_LLS

FYI the workaround for this is to publish your survey with the geoshape geometry in the form but add a pulldata statement to create a join field to a dataset which contains the multipart geometry youre after. 

 

Once the survey is published, I run a script that then updates the geometry of the Survey geoshape based on the linked datasets geometry..

AlfredBaldenweck

Interesting! Would you be able to share a sample?

In the meantime, I'd like to say that just because a user has found a workaround doesn't mean this isn't still desired functionality.

MarkWILSON_LLS

Its definitely still desired. workarounds suck..

Copilot and i mashed up a script. we're becoming good friends. 

the script runs locally for now. hoping to get notebooks enabled on AGOL so i can automate it hourly or triggered by a data submission .
I (well copilot...) also did an optimised version that refines the source dictionary by the features that need updating. this saves time if your source has lots of features...

............................

##Updates Geometry of Reserves attached to Permit from the Master
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
import datetime

# 1. Connect to ArcGIS Online
gis = GIS("Your AGOL", "USER", "PWD")

# 2. Access the source and target feature layers
source_layer_url = "URL1"
target_layer_url = "URL2"

source_layer = FeatureLayer(source_layer_url)
target_layer = FeatureLayer(target_layer_url)

# 3. Query all features from both layers
source_features = source_layer.query(where="1=1", out_fields="GlobalID", return_geometry=True).features
target_features = target_layer.query(where="1=1", out_fields="TSRID", return_geometry=True).features

# 4. Create a dictionary for quick lookup from source
source_dict = {f.attributes['GlobalID']: f.geometry for f in source_features}

# 5. Update target geometries
updates = []
for feature in target_features:
uid = feature.attributes['TSRID']
if uid in source_dict:
feature.geometry = source_dict[uid]
updates.append(feature)

# 6. Apply updates
if updates:
result = target_layer.edit_features(updates=updates)
print(f"Updated {len(updates)} features at {datetime.datetime.now()}")
else:
print("No matching features found to update.")