Mapbox web API easy access.

elm, mapbox
elm-package install ghivert/elm-mapbox 1.0.0



Elm Mapbox aims to provide an easy way to interact with Mapbox web API. Using this package allows to embed a map into a webpage or retrieve tiles informations.


Predefined functions

In its more simple form, all you have to do is to use predefined functions with correct parameters, i.e. you Mapbox access_token and the correct enpoint.

import Mapbox.Maps.SlippyMap as Mapbox
import Mapbox.Endpoint as Endpoint

mapboxToken : String
mapboxToken =

-- Embed a slippy map into your website and set Options, Hash and Size of the iframe.
embeddedSlippyMap : Html msg
embeddedSlippyMap =
    Mapbox.slippyMap Endpoint.streets mapboxToken Nothing Nothing (Mapbox.Size 1000 1000)

Tiles and EditorProject are returning Http.Requests GeoJson. GeoJson is a specific Json format representing geographical coordinates and data. It is defined in the package mgold/elm-geojson, and you can find additional informations on or the RFC7946 specification.

Constructing your own requests

You may prefer to construct your own request directly to Mapbox. To do it, use Mapbox.url the different arguments are constructing urls based on the Mapbox schema, i.e.{endpoint}{options}{format}?access_token={accessToken}{parameters}. Obviously, you should preferably use predefined functions, guaranting type checking and providing HTML embedding or HTTP Requests.