Skip to content

Commit 300bbbe

Browse files
authored
Merge pull request #2227 from Esri/add_popup_example
Code snippet for adding fields to popup
2 parents a7959be + 5447b04 commit 300bbbe

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

guide/05-working-with-the-spatially-enabled-dataframe/visualizing-data-with-the-spatially-enabled-dataframe.ipynb

+28
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,34 @@
14071407
"county_sdf.spatial.plot(map_widget=m9)"
14081408
]
14091409
},
1410+
{
1411+
"cell_type": "markdown",
1412+
"metadata": {},
1413+
"source": [
1414+
"### Add Popup Field Info"
1415+
]
1416+
},
1417+
{
1418+
"cell_type": "markdown",
1419+
"metadata": {},
1420+
"source": [
1421+
"Finally, we can add field information from the dataframe to the popup for it to display on the map when a user clicks on a specific county."
1422+
]
1423+
},
1424+
{
1425+
"cell_type": "code",
1426+
"execution_count": null,
1427+
"metadata": {},
1428+
"outputs": [],
1429+
"source": [
1430+
"from arcgis.map.dataclasses.models import FieldInfo\n",
1431+
"\n",
1432+
"pu = m9.content.popup(0)\n",
1433+
"pu.disable_popup = False\n",
1434+
"fields = [FieldInfo(field_name=fld) for fld in county_sdf.columns]\n",
1435+
"pu.edit(\"County Data\", field_infos=fields)"
1436+
]
1437+
},
14101438
{
14111439
"cell_type": "markdown",
14121440
"metadata": {},

0 commit comments

Comments
 (0)