I want to have a user add points by clicking on a map in a Jupyter Notebook and those points get pushed to a feature service.
I'm able to accomplish that task, but I would like the user to be able to customize the attribution for the points they just added.
I'm envisioning a pop up with the various fields that appears when the user adds a point on the map and they just type in a string. I've tried using input(), as well as ipywidgets.
Is there another way to accomplish this?
Most of the examples I see online are for the ArcGIS JavaScript API.
def create_feature(_map, location):
try:
object_id = 1
point = geometry.Point(location)
feature = features.Feature(
geometry=point,
attributes={
'OBJECTID': object_id,
'PARK_NAME': 'My Park',
'TRL_NAME': 'Foobar Trail',
'ELEV_FT': '5000'
}
)
trailheads_layer.edit_features(adds=[feature])
_map.draw(point)
except Exception as e:
print("Couldn't create the feature. {}".format(str(e)))
m.on_click(create_feature)