Hi,
I want to create a quick Webmap to preview some points from a database via pandas. The points display correctly, and they render correctly (diamond marker) but for the life of me I can't work out how to display labels on each of the points. Example code below:
#### Only for testing
from arcgis.gis import GIS
import pandas as pd
area = 'ARG'
data = {'name': ['Hole 1', 'Hole 2'],
'x': [-66.3211, -66.3186],
'y': [-24.3959, -24.3948]}
df = pd.DataFrame(data)
#### Only for testing
popup_info = {
"title": "{name}", "description" : "{name}"
}
labelClass = {
"showLabels": True,
"renderer": {
"type": "simple",
"symbol": {
"type": "esriSMS",
"style": "esriSMSDiamond",
"color": [
255,
0,
0,
200
],
"size": 8,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"outline": {
"color": [
0,
0,
0,
255
],
"width": 1
}
}
},
"labelingInfo": [
{
"labelExpression": "",
"labelExpressionInfo": {
"expression": "$feature[\"name\"]",
"value": "{name}"
},
"symbol": {
"type": "esriTS",
"color": [
78,
78,
78,
255
],
"backgroundColor": [
0,
0,
0,
0
],
"borderLineSize": 2,
"borderLineColor": [
255,
0,
255,
255
],
"haloSize": 2,
"haloColor": [
0,
255,
0,
255
],
"verticalAlignment": "bottom",
"horizontalAlignment": "left",
"rightToLeft": False,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"kerning": True,
"font": {
"family": "Arial",
"size": 12,
"style": "normal",
"weight": "bold",
"decoration": "none"
}
}
}
]
}
gis = GIS("home")
sdf = pd.DataFrame.spatial.from_xy(df, x_column='x', y_column='y')
map_widget = gis.map(area)
map_widget.content.add(sdf, options={'opacity':0.75},popup_info=popup_info, drawing_info=labelClass)
display(map_widget)