Mapbox-GL utils, commonly used map service data sources. | 常用的地图服务数据源。
MIT License
This is a utils of Mapbox-GL.
The tool provides a data Source for daily use.
Including the following map services:
TianDiTu
OpenStreetMap
The following bundles are provided:
types/
build/
├── bundle.js
├── bundle.min.js
├── bundle.esm.js
├── bundle.esm.min.js
├── bundle.cjs.js
├── bundle.cjs.min.js
├── bundle.umd.js
└── bundle.umd.min.js
It also provides the corresponding sourcemap file.
In the browser, referenced by the <script>
tag:
<script src="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.js"></script>
<!-- Reference the utils library -->
<script src="../build/bundle.min.js"></script>
It is mounted at mapboxgl._utils.Source
, so you can use it like this:
const { TianDiTu, Google } = mapboxgl._utils.Source
If you can't get the bundle file, you can try to build it yourself.
Install via npm:
npm install mapbox-gl-utils-source
Use it like this:
// ES Module
import { TianDiTu, Google } from 'mapbox-gl-utils-source'
// CommonJS
const utilsSource = require('mapbox-gl-utils-source')
If you cannot get the bundle file, or you want to add additional map service resources and other reasons, you can build your own.
First, clone
to local
git clone https://github.com/wang1212/mapbox-gl-utils-source.git <dir>
cd <dir>/
npm install
Then you can modify the files in src/ by yourself, and run the following command when finished:
npm run build
The bundle file will be generated in the build/ folder, include sourcemap file.
MIT.