✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Issue : Adding a symbol layer in plotly mapbox with python

Hi,

I am trying to achieve something like this, but instead of scatter plot it is density_mapbox plot :slight_smile:name

I have geojson file that allows me to add borders to areas in the city just as above. This geojson also contains name of the area but I am not able to display it using another layer that can be of type ‘symbol’.

fig = go.Figure(go.Densitymapbox(lat=heat_map['LATITUDE'], lon=heat_map['LONGITUDE'], z=heat_map['COUNT'],
                                         radius=10, customdata=heat_map['LOCATION'],hovertemplate =
    '<i>LOCATION</i>: %{customdata}<br><i>TICKETS</i>: %{z}<extra></extra>'))

    fig.update_layout(mapbox_style="stamen-terrain",
                      mapbox_layers=[
                          {
                              "below": 'traces',
                              "sourcetype": "geojson",
                              "source": features,
                              "opacity": 0.5,
                              "type": "line",
                              "line":{
                                "width":4
                              },

                              "color": '#dc3545'

                          },
                          {
                              "below": 'traces',
                              "sourcetype": "geojson",
                              "source": features,
                              "opacity": 0.3,
                              "type": "fill",
                              "color": '#dc3545'

                          },
                          {

                              "sourcetype": "geojson",
                              "source": feature,
                              "type": "symbol",
                              "symbol":{
                                  "text":"name",
                                  "placement":"point",
                                  "textfont": {
                                      "size":20,
                                      "color":"#3f4f75"
                                  },
                                "textposition":"middle center"
                              }
                          }
                      ],
                      mapbox_zoom=11,mapbox_center_lat=49.24, mapbox_center_lon=-123.124)

The sample of my geojson is like

{
	"type": "FeatureCollection",
	"features": [
		{
			"type": "Feature",
			"geometry": {
				"type": "Polygon",
				"coordinates": [
					[
						[
							-123.17016601562499,
							49.24789047240798
						],
                                                [
							-123.17016601562499,
							49.24789047240798
						],
					]
				]
			},
			"properties": {
				"mapid": "DS",
				"name": "Dunbar-Southlands",
				"geo_point_2d": [
					49.2379619063,
					-123.189546803
				]
			}
		}
.. // similar format as above
..
..
}

I am able to achieve this :

But I am not able to show the name of the area.