Skip to content
ReasonML + BuckleScript bindings for Mapbox GL JS 🚧
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
debug
src
.babelrc
.gitignore
CHANGELOG.md
README.md
bsconfig.json
package-lock.json
package.json

README.md

bs-mapbox-gl

Build Status npm

BuckleScript bindings for Mapbox GL JS.

Mapbox GL JS is a JavaScript library that renders interactive maps from vector tiles and Mapbox styles using WebGL.

Mapbox GL gallery

Status

This package is 🚧 WIP 🚧.

Feel free to create an issue or PR if you find anything missing.

Installation

npm install --save mapbox-gl bs-mapbox-gl

Then add bs-mapbox-gl to bs-dependencies in your bsconfig.json:

{
  "bs-dependencies": ["bs-mapbox-gl"]
}

Usage

To use any of Mapbox’s tools, APIs, or SDKs, you’ll need a Mapbox access token. Mapbox uses access tokens to associate requests to API resources with your account. You can find all your access tokens, create new ones, or delete existing ones on your API access tokens page.

open MapboxGL;

// set the mapbox access token
setAccessToken(mapboxGL, accessToken);

// get map container
let container = Option.getExn(getElementById("map", document));

// set map options
let map_options = {
  "container": container,
  "style": "mapbox://styles/mapbox/streets-v9",
  "center": LngLat.make(~lng=-74.50, ~lat=40.),
  "zoom": 9.,
};

// create and display map
let map = MapGL.make(map_options);

You can find more examples here.

Contributing

Clone and install dependencies

git clone https://github.com/stepankuzmin/bs-mapbox-gl.git
cd bs-mapbox-gl
npm install

Start the debug server

MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} npm start

Open the debug page at http://localhost:1234

You can’t perform that action at this time.