<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Displaying labels on points in Jupyter notebook widget map? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598395#M11246</link>
    <description>&lt;P&gt;Thanks, Glen&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried both methods, and I must not have 2.4.0 yet because neither suggestion worked for me:&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_45388\2082314680.py in &amp;lt;cell line: 64&amp;gt;()
     62     ]
     63 
---&amp;gt; 64 map_widget.content.add(feature_collection) # Add the feature collection as a map layer
     65 
     66 feature_collection.properties["layers"][-1]['layerDefinition']['drawingInfo']['labelingInfo'] = labeling_info

AttributeError: 'MapView' object has no attribute 'content'&lt;/LI-CODE&gt;&lt;LI-CODE lang="sql"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_45388\1711682042.py in &amp;lt;cell line: 110&amp;gt;()
    108 layer = map_widget.layers[0]
    109 
--&amp;gt; 110 map_widget.update_drawing_info(
    111     layer = layer,
    112     label_info = labeling_info,

AttributeError: 'MapView' object has no attribute 'update_drawing_info'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found &lt;A href="https://developers.arcgis.com/python/latest/guide/overview24/" target="_self"&gt;&lt;STRONG&gt;this page&lt;/STRONG&gt;&lt;/A&gt; which describes the 2.4.0 techniques you're referencing. Looks like the ideal solution will be to upgrade, but I must get buy-in from my whole team before doing so....&lt;/P&gt;&lt;P&gt;In the meantime, I also came across a &lt;STRONG&gt;RendererManager&lt;/STRONG&gt; description [&lt;STRONG&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.map.toc.html#arcgis.map.renderers.RendererManager.renderer" target="_blank" rel="noopener"&gt;link&lt;/A&gt;&lt;/STRONG&gt;] that I think might cooperate with my version of the API for Python, but I don't have any clue how to get it to work. (I'm only just starting to learn all this stuff.)&lt;/P&gt;&lt;P&gt;Any further help would be super appreciated! And thanks again!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Mar 2025 03:32:13 GMT</pubDate>
    <dc:creator>BBowers_napacounty</dc:creator>
    <dc:date>2025-03-24T03:32:13Z</dc:date>
    <item>
      <title>Displaying labels on points in Jupyter notebook widget map?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1596378#M11231</link>
      <description>&lt;P&gt;Hi! I'm trying to get labels working in my Jupyter notebook map, and I've tried everything I can think of.&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.geometry import Point
from arcgis.features import Feature, FeatureSet, FeatureCollection, FeatureLayer, FeatureLayerCollection
import arcgis.mapping
from ipywidgets import *

name_coords_matches_list = [('American Canyon', 38.1743, -122.2583)]

map_widget = gis.map("Napa County, California, USA")

point_features = []
for point_datum in name_coords_matches_list:
point_geometry = Point({"x": float(point_datum[2]), "y": float(point_datum[1]), "spatialReference": {"wkid": 4326}}) # Create a dict for the long/lat point
point_attributes = {"name": point_datum[0]} # Create a dict for the 'name' attribute
point_feature = Feature(geometry=point_geometry, attributes=point_attributes) # Create the feature
point_features.append(point_feature) # Add the feature to the point_features list

feature_set = FeatureSet(point_features) # Create the feature set of all point features

feature_collection = FeatureCollection.from_featureset(feature_set) # Create a feature collection from the feature set
feature_collection.properties["layers"][0]['layerDefinition']['drawingInfo']['renderer']['symbol']['color'] = [255, 255, 0, 127] # Make the point symbols translucent yellow
labeling_info = [{
"labelExpression": "[name]", "labelExpressionInfo": {"expression": "$feature.name"},
"maxScale": 0, "minScale": 0, "symbol": {
"color": [104, 104, 104, 255], "type": "esriTS",
"font": {"decoration": "none", "family": "Arial", "size": 8, "style": "normal", "weight": "bold"}
}
}]
feature_collection.properties["layers"][0]['layerDefinition']['drawingInfo']['labelingInfo'] = labeling_info # Add the labeling info
feature_collection.properties["layers"][0]['layerDefinition']['showLabels'] = True # Turn on labels

map_widget.add_layer(feature_collection) # Add the feature collection as a map layer

map_widget.layout=Layout(flex='1 1', padding='0px', height='1024px') # Change the dimensions of the map widget in Jupyter
map_widget # Display the map widget&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point is displayed, and its color is right, but it is missing the label&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-03-17 16_02_40-OpenAI - Jupyter Notebook and 1 more page - Work - Microsoft​ Edge.png" style="width: 967px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128100i442D0C0DEAFF4F4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-03-17 16_02_40-OpenAI - Jupyter Notebook and 1 more page - Work - Microsoft​ Edge.png" alt="2025-03-17 16_02_40-OpenAI - Jupyter Notebook and 1 more page - Work - Microsoft​ Edge.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's the JSON from printing &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;feature_collection.properties&lt;/FONT&gt;&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="css"&gt;{
  "layers": [
    {
      "featureSet": {
        "geometryType": "esriGeometryPoint",
        "features": [
          {
            "geometry": {
              "x": -122.2583,
              "y": 38.1743,
              "spatialReference": {
                "wkid": 4326
              }
            },
            "attributes": {
              "name": "American Canyon",
              "OBJECTID": 1
            }
          },
		]
      },
      "layerDefinition": {
        "geometryType": "esriGeometryPoint",
        "fields": [
          {
            "name": "name",
            "alias": "name",
            "type": "esriFieldTypeString",
            "sqlType": "sqlTypeOther"
          },
          {
            "name": "OBJECTID",
            "type": "esriFieldTypeOID",
            "alias": "OBJECTID",
            "sqlType": "sqlTypeOther"
          }
        ],
        "spatialReference": {
          "wkid": 4326
        },
        "objectIdField": "OBJECTID",
        "type": "Feature Layer",
        "name": "a450db",
        "id": 0,
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSMS",
              "color": [
                255,
                255,
                0,
                127
              ],
              "angle": 0,
              "xoffset": 0,
              "yoffset": 0,
              "size": 12,
              "style": "esriSMSCircle",
              "outline": {
                "type": "esriSLS",
                "color": [
                  0,
                  0,
                  0,
                  255
                ],
                "width": 0.75,
                "style": "esriSLSSolid"
              }
            }
          },
          "labelingInfo": [
            {
              "labelExpression": "[name]",
              "labelExpressionInfo": {
                "expression": "$feature.name"
              },
              "maxScale": 0,
              "minScale": 0,
              "symbol": {
                "color": [
                  104,
                  104,
                  104,
                  255
                ],
                "type": "esriTS",
                "font": {
                  "decoration": "none",
                  "family": "Arial",
                  "size": 8,
                  "style": "normal",
                  "weight": "bold"
                }
              }
            }
          ]
        },
        "showLabels": true
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated. Thanks in advance!&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 23:20:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1596378#M11231</guid>
      <dc:creator>BBowers_napacounty</dc:creator>
      <dc:date>2025-03-17T23:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying labels on points in Jupyter notebook widget map?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598329#M11244</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/734666"&gt;@BBowers_napacounty&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I was able to get this to work using the ArcGIS API for Python version 2.4.0 as per below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.geometry import Point
from arcgis.features import Feature, FeatureSet, FeatureCollection, FeatureLayer, FeatureLayerCollection
import arcgis.map
from ipywidgets import *

gis = GIS("home")

name_coords_matches_list = [('American Canyon', 38.1743, -122.2583)]

map_widget = gis.map("Napa County, California, USA")

point_features = []
for point_datum in name_coords_matches_list:
    point_geometry = Point({"x": float(point_datum[2]), "y": float(point_datum[1]), "spatialReference": {"wkid": 4326}}) # Create a dict for the long/lat point
    point_attributes = {"name": point_datum[0]} # Create a dict for the 'name' attribute
    point_feature = Feature(geometry=point_geometry, attributes=point_attributes) # Create the feature
    point_features.append(point_feature) # Add the feature to the point_features list

feature_set = FeatureSet(point_features) # Create the feature set of all point features

feature_collection = FeatureCollection.from_featureset(feature_set) # Create a feature collection from the feature set
feature_collection.properties["layers"][0]['layerDefinition']['drawingInfo']['renderer']['symbol']['color'] = [255, 255, 0, 127] # Make the point symbols translucent yellow

labeling_info = [{
"labelExpression": "[name]", "labelExpressionInfo": {"expression": "$feature.name"},
"maxScale": 0, "minScale": 0, "symbol": {
"color": [104, 104, 104, 255], "type": "esriTS",
"font": {"decoration": "none", "family": "Arial", "size": 8, "style": "normal", "weight": "bold"}
}
}]

map_widget.content.add(feature_collection) # Add the feature collection as a map layer

options_dict = {
    "showLabels" : True,
    "layerDefinition" : {
        "drawingInfo" : {
            "labelingInfo" : labeling_info
        }
    }
}


map_widget.content.update_layer(
    index=0,
    options=options_dict
)

map_widget&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_0-1742723837395.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128511i62A1D7AEDE7E0BC9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1742723837395.png" alt="Clubdebambos_0-1742723837395.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If bound to using 2.3.0 or previous, you can try the following (I have no way of testing)&lt;/P&gt;&lt;P&gt;Follow the same as above with exception of the below...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;map_widget.add_layer(feature_collection) # Add the feature collection as a map layer

layer = map_widget.layers[0]

map_widget.update_drawing_info(
    layer = layer,
    label_info = labeling_info,
    show_labels = True
)

map_widget&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let us know if either of those work for you.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 10:02:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598329#M11244</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-03-23T10:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying labels on points in Jupyter notebook widget map?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598395#M11246</link>
      <description>&lt;P&gt;Thanks, Glen&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried both methods, and I must not have 2.4.0 yet because neither suggestion worked for me:&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_45388\2082314680.py in &amp;lt;cell line: 64&amp;gt;()
     62     ]
     63 
---&amp;gt; 64 map_widget.content.add(feature_collection) # Add the feature collection as a map layer
     65 
     66 feature_collection.properties["layers"][-1]['layerDefinition']['drawingInfo']['labelingInfo'] = labeling_info

AttributeError: 'MapView' object has no attribute 'content'&lt;/LI-CODE&gt;&lt;LI-CODE lang="sql"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_45388\1711682042.py in &amp;lt;cell line: 110&amp;gt;()
    108 layer = map_widget.layers[0]
    109 
--&amp;gt; 110 map_widget.update_drawing_info(
    111     layer = layer,
    112     label_info = labeling_info,

AttributeError: 'MapView' object has no attribute 'update_drawing_info'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found &lt;A href="https://developers.arcgis.com/python/latest/guide/overview24/" target="_self"&gt;&lt;STRONG&gt;this page&lt;/STRONG&gt;&lt;/A&gt; which describes the 2.4.0 techniques you're referencing. Looks like the ideal solution will be to upgrade, but I must get buy-in from my whole team before doing so....&lt;/P&gt;&lt;P&gt;In the meantime, I also came across a &lt;STRONG&gt;RendererManager&lt;/STRONG&gt; description [&lt;STRONG&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.map.toc.html#arcgis.map.renderers.RendererManager.renderer" target="_blank" rel="noopener"&gt;link&lt;/A&gt;&lt;/STRONG&gt;] that I think might cooperate with my version of the API for Python, but I don't have any clue how to get it to work. (I'm only just starting to learn all this stuff.)&lt;/P&gt;&lt;P&gt;Any further help would be super appreciated! And thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 03:32:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598395#M11246</guid>
      <dc:creator>BBowers_napacounty</dc:creator>
      <dc:date>2025-03-24T03:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying labels on points in Jupyter notebook widget map?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598889#M11252</link>
      <description>&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;I got access to an earlier version and I could not get it to comply. Perhaps the update to 2.4.0 is the way to go. Just to note that 2.4.0 had some major updates (see &lt;A href="https://developers.arcgis.com/python/latest/guide/overview24/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;) and any workflows around WebMaps from previous versions will more than likely fail to work unless the scripts are upgraded to the latest.&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 10:21:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/displaying-labels-on-points-in-jupyter-notebook/m-p/1598889#M11252</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-03-25T10:21:17Z</dc:date>
    </item>
  </channel>
</rss>

