How to add point geometry to an attribute table in ArcGIS Online?

1606
1
11-26-2019 08:43 AM
RyanHowell1
New Contributor III

I have a table on ArcGIS online that has a mix of point features, some have geometry assigned to them and display on the map while others do not have a point assigned to them. I would like to be able to select a given row and manually drop a point to be associated with that row.

It looks like this will work in ArcGIS Pro if I select the row and use the Replace Geometry tool in the Editing panel. Is there a way to perform this edit directly on AGOL?

Thank you for any suggestions

0 Kudos
1 Reply
by Anonymous User
Not applicable

Hi Ryan Howell‌,

I think this enhancement - ENH-000117521: The ability to create point geometry for an existing feature that has null coordinates or spatial values using the Edit widget in Web AppBuilder for ArcGIS Online would be worth contacting Esri Support to attach your customer number. 

How were the features with Null geometry created?

While this isn't possible in the Graphic User Interface (GUI), I tested this a little bit in-house and think you might be able to do this with the ArcGIS API for Python (This guide goes into setting up the Python environment if you are new to the API). This enables editing in X,Y values directly into the geometry of the feature. It is posted here if you want to test it out to see if works for your data. It is just a slight modification of the public code sample here: Editing Features | ArcGIS for Developers. Alternatively if you can attach a sample FGDB to this thread I would be happy to give it a quick test on my end. 

#Connect to the GIS
from arcgis.gis import GIS
from IPython.display import display
gis = GIS("https://arcgis.com", "YourUsername")

#Search for the Feature Layer
search_result = gis.content.search('title:YourItemTitle')
search_result[0]

#Create a FeatureSet
ChangeGeo_item = search_result[0]
ChangeGeo_layers = ChangeGeo_item.layers
ChangeGeo_layers
ChangeGeo_fset = ChangeGeo_layers[0].query()


#Query an Object ID, select the feature, then view the geometry.
ChangeGeo_features = ChangeGeo_fset.features
ChangeGeo_Two = [f for f in ChangeGeo_features if f.attributes['OBJECTID']==3][0]
GeoView = ChangeGeo_Two.geometry
print(GeoView)

#Set a Feature Layer and define a geometry edit in Web Mercator (places the point near Redlands), then update the Feature Layer
Geo_FeatureLayer = ChangeGeo_layers[0]
ChangeGeo_edit = ChangeGeo_Two
ChangeGeo_edit.geometry['x'] = -13081721
ChangeGeo_edit.geometry['y'] = 4018906
update_result = Geo_FeatureLayer.edit_features(updates=[ChangeGeo_edit])
print(update_result)

#View the feature's updated geometry
print(GeoView)

Hope this helps,

-Peter