First, you need to install the deck.gl (and luma.gl) frameworks
npm install deck.gl --saveor
yarn add deck.glAs of v5.0, installing deck.gl automatically installs a compatible version of luma.gl. However if your application directly uses the luma.gl API you may still need to explicitly install
luma.glwith your app (see remarks below).
The deck.gl repository contains an examples folder with a selection of small, standalone examples that could be good starting points for your application.
You should be able to copy these folders to your preferred locations, and get them running simply as follows:
Clone the deck.gl repo, if you haven't already
git clone git@github.com:uber/deck.gl.gitFor most consistent results, it is recommended that you check out the latest release branch (e.g. git checkout 6.0-release) instead of master when running examples.
git checkout 6.0-releaseChange directory to the example you are interested in
cd deck.gl/examples/...Then install dependencies using the installer of your choice:
npm installor
yarnand then running using:
npm startIf the example uses a mapbox base map you need a Mapbox access token
export MapboxAccessToken={Your Token Here} && npm startIf you want to build the example against the latest deck.gl source code in the cloned repo (rather than the published version of deck.gl listed in the examples package.json)
npm run start-localThe examples on the
masterbranch are updated to use features from the latest, unreleased version of deck.gl. If some example doesn't work usingnpm startit can be worth tryingnpm run start-local.
While all examples support
npm run start-local, there are some caveats when running against local source. Most importantly, you must make sure to runnpm installoryarnin the deck.gl root folder before runningnpm run start-localin an example folder.
- The need for explicitly installing luma.gl can depend on which installation tool you use (
npm install,yarnetc) and exact behavior can vary between versions of these tools. - When explicitly installing, there is a risk of getting multiple versions installed (deck.gl and luma.gl will warn at run-time in the console if multiple copies are detected). One of the best tools to debug such issues is
npm lsand carefully checking your deck and luma version specifications in your package.json.