From 2734e2c3f9d8773a52f5b20f856a02ba2268b6a8 Mon Sep 17 00:00:00 2001 From: samanpwbb Date: Wed, 4 Mar 2015 15:04:06 -0500 Subject: [PATCH] fix options documentation, document setAccessToken method, refs #93 --- README.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d8a2353bf..618f99f57 100644 --- a/README.md +++ b/README.md @@ -35,15 +35,34 @@ The first argument passed to `map.render` is an options object, all keys are opt ```js { zoom: {zoom}, // number, defaults to 0 - width: {width}, // number (px), defaults to 256 - height: {height}, // number (px), defaults to 256 + width: {width}, // number (px), defaults to 512 + height: {height}, // number (px), defaults to 512 latitude: {latitude}, // number (coordinate), defaults to 0 longitude: {longitude}, // number (coordinate), defaults to 0 - bearing: {bearing}, // number (degree), defaults to 0 - ratio: {ratio} // number (scale factor), defaults to 1.0 + bearing: {bearing}, // number (in degrees, counter-clockwise from north), defaults to 0 + ratio: {ratio} // number (scale factor), defaults to 1.0, + classes: {classes} // array of strings, optional * } ``` +* More about classes: https://github.com/mapbox/mapbox-gl-js/blob/master/API.md#working-with-style-classes + +## Mapbox API Access tokens + +To use styles that rely on Mapbox vector tiles, you must register a [API access token](https://www.mapbox.com/developers/api/#access-tokens) on the map. Use the `setAccessToken` method before load: + +```js +var map = mbgl.Map(fileSource); +var style = mapboxStyle; // includes a datasource with a reference to something like `mapbox://mapbox.mapbox-streets-v6` +map.setAccessToken(process.env.MAPBOX_ACCESS_TOKEN); +map.load(style); +map.render({}, function(err, image) { + if (err) throw err; + fs.writeFileSync('image.png', image); +}); + +``` + ## Testing ```