Page 1 of 1

Mapbox utilization

Posted: Fri 04 May 04 2018 12:00 am
by Daniel Wee
For offline calculation of tiles required, use:-

https://www.mapbox.com/help/offline-estimator/

Bounding box of:
SW 1.21766 103.60073
NE 1.47212 104.03532

Min zoom: 10
Max zoom: 16

Tiles required: 5300

Re: Mapbox utilization

Posted: Fri 04 May 04 2018 12:01 am
by Daniel Wee
Minimal code using offline plotly here. Outputs a map with a marker to a named html file which can then be opened up in a browser.

For more info on offline mode, see:-

https://www.reddit.com/r/IPython/commen ... line_mode/

Code: Select all

import  plotly.offline  as py
from plotly.graph_objs import *

mapbox_access_token = 'PLACE MAPBOX TOKEN HERE'

data = Data([
    Scattermapbox(
        lat=['1.30767442232997'],
        lon=['103.796271571462'],
        mode='markers',
        marker=Marker(
            size=14
        ),
        text=['272005'],
    )
])

layout = Layout(
    autosize=True,
    hovermode='closest',
    mapbox=dict(
        accesstoken=mapbox_access_token,
        bearing=0,
        center=dict(
            lat=1.347865,
            lon=103.81622
        ),
        pitch=0,
        zoom=10
    ),
)

fig = dict(data=data, layout=layout)
py.plot(fig, filename='Singapore-Mapbox.html')

Re: Mapbox utilization

Posted: Fri 04 May 04 2018 12:03 am
by Daniel Wee
For multiple markers in an array, see:-

https://plot.ly/python/scattermapbox/#new-to-plotly