As Mapbox decided to go open source, we decided it would be excellent to incorporate Mapbox's beautiful map engine into our SDK. Rather than relying on the main repository, though, it made sense to create our own fork so:
- Even if the main source code goes away, we have a stable copy
- We can make our own customizations as / when needed (see next question)
First of all, it allows us to keep a stable copy of the source code in a safe place. Just in case Mapbox changes their mind one day.
Secondly, this allows us to make minor customizations as / when needed. At the moment, we have 1 customization: to disable Telemetry. Mapbox, by default, includes a Telemetry component that measures and reports how their maps are used (ie. user analytics). Although it should be possible to disable this via configuration, the documentation is not very clear and it is risky to rely on this functionality working (in fact, there are many developers complaining that they failed to use the Api or find any documentation on this). We cannot let our SDK upload analytics to a 3rd party server. Therefore, we have disabled Telemetry by disabling it directly from the source code.
-
Go to
github.com
and generate a personal key token with only 'write:packages' and 'read:packages' scopes. (https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) -
Create
~/.npmrc
with the following content: (Both Windows and Mac)
//npm.pkg.github.com/:_authToken=TOKEN
- Create a
.npmrc
file in the project root folder (wherepackage.json
resides) (already done incore-web-sdk
repo)
registry=https://npm.pkg.github.com/pointrlabs
- Add
@pointrlabs/mapbox-gl-js
with the correctpointr
version topackage.json
eg.
{
...
"dependencies": {
"@pointrlabs/mapbox-gl": "1.11.1-pointr"
}
}
-
Run
npm install
to install@pointrlabs/mapbox-gl-js
. ** Note: npm will smartly install all other dependencies via public npm registry. ** -
Import the module to use it
var mapbox = import(@pointrlabs/mapbox-gl-js)
Note: As long as you don't use Mapbox data, you do not need an access token. Just use a dummy string instead.
From time to time, we should
- Pull the latest code from Mapbox and update our fork
- If there's a new stable Mapbox version, we should create a
release/A.B.C
branch cherry-pick
all Pointr changes (2-3 commits, not more)- Suffix version name with
pointr
(eg.1.11.1
->1.11.1-pointr
) - Call
npm publish
to publish this latest version to Github - Point your
package.json
(incore-web-sdk
or else) to this latest version instead and callnpm install
** Note: It might be easier to have a pointr
branch instead and use tags for each version. We can keep rebasing from the main source. **
No. When the web SDK is compiled, it creates 1x pointrwebsdk.js
file that already contains Mapbox
. So once compiled, there are no more dependencies to access and 3rd parties only need that 1 file.
Mapbox GL JS is a JavaScript library for interactive, customizable vector maps on the web. It takes map styles that conform to the Mapbox Style Specification, applies them to vector tiles that conform to the Mapbox Vector Tile Specification, and renders them using WebGL.
Mapbox GL JS is part of the cross-platform Mapbox GL ecosystem, which also includes compatible native SDKs for applications on Android, iOS, macOS, Qt, and React Native. Mapbox provides building blocks to add location features like maps, search, and navigation into any experience you create. To get started with GL JS or any of our other building blocks, sign up for a Mapbox account.
In addition to GL JS, this repository contains code, issues, and test fixtures that are common to both GL JS and the native SDKs. For code and issues specific to the native SDKs, see the mapbox/mapbox-gl-native repository.
- Getting started with Mapbox GL JS
- Tutorials
- API documentation
- Examples
- Style documentation
- Open source styles
- Contributor documentation
Mapbox GL JS is licensed under the 3-Clause BSD license. The licenses of its dependencies are tracked via FOSSA: