Scattermapbox - marker symbol location pin

Hi Team,

I am trying plot a map in which I want the co-ordinates to displayed as a replica of google map
How do change the default symbol from circle to location pin. Can you please provide an example of the symbol = “location pin”

Hi @ashti,

Welcome to forum! The mapbox symbol for ‘location pin’ is symbol ='marker', but the marker_color='red', for example, has no effect. Mapbox ‘marker’ is 'black by default.

Example:

mapboxt = open(".mapbox_token").read().rstrip() #my mapbox_access_token 
lats = [52.370216, 53.2191696,  50.851368, 51.8125626]
lons = [4.895168,  6.5666699, 5.690973, 5.8372264 ]
scatt = go.Scattermapbox(
            lat=lats,
            lon=lons,
            mode='markers',
            hovertext=['Amsterdam', 'Groningen',  'Maastricht', 'Nijmegen'],  
            hoverinfo='text',                 
            below='',                 
            marker=dict(symbol ='marker', size=15, color='blue'))
layout = go.Layout(title_text ='Pin location at a few cities in Netherlands', 
                   title_x =0.5, width=750, height=700,
                   mapbox = dict(center= dict(lat=52.370216, lon=4.895168),            
                                 accesstoken= mapboxt,
                                 zoom=6,
                                 style="light"
                               ))

fig=go.Figure(data=[ scatt], layout =layout)

For more symbols see this discussion: Scattermapbox marker with no fill

Thank you for this. Can we change the location color pin to red instead of black…

There are other marker options as well which can be seen in : https://labs.mapbox.com/maki-icons/
marker-15.svg,marker-stroked.svg. Whats the right syntax to use them in the code…I am assuming 11 and 15 are the size properties

  1. No, unfortunately we can’t change the color.

  2. The marker size displayed in the maki table must be omitted when you define symbol ='some-icon'

@ashti

I realized that it is possible to define custom location pins, but not as svg paths. I defined them here https://plot.ly/~empet/15362/custom-location-pins/#/ as mapbox layers (https://plot.ly/python/mapbox-layers/) from geojson sources.