# mapbox-gl-utils-source **Repository Path**: i_wang1212/mapbox-gl-utils-source ## Basic Information - **Project Name**: mapbox-gl-utils-source - **Description**: :earth_asia: Mapbox-GL utils, commonly used map service data sources. | 常用的地图服务数据源。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-05-25 - **Last Updated**: 2023-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Mapbox-GL utils - Source 这是 [Mapbox-GL](https://docs.mapbox.com/mapbox-gl-js/overview/) 的一个工具库。 该工具提供了日常使用的地图数据源([Source](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/))。 [Demo](./test/index.html) [English](./README.md) | [简体中文](./README.zh-CN.md) ## 地图资源 包含以下的地图服务资源: - TianDiTu - TianDiTu.satellite.map - TianDiTu.satellite.annotation - TianDiTu.streets.map - TianDiTu.streets.annotation - Google - Google.satellite.Map - Google.streets.mapWithAnnotation - OpenStreetMap - OSM.streets.mapWithAnnotation ## 打包文件 提供了以下捆绑包文件: 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 同时也提供了对应的 **sourcemap** 文件。 ## 用法 ### 浏览器 在浏览器中,通过 ` ``` 该工具库挂载在 `mapboxgl._utils.Source` 位置,所以你可以这样使用: ```js const { TianDiTu, Google } = mapboxgl._utils.Source ``` **_如果你无法获取捆绑包文件, 你可以尝试 [自己构建](#build)._** ### Node.js 通过 npm 安装: ```bash npm install mapbox-gl-utils-source ``` 这样使用: ```js // ES Module import { TianDiTu, Google } from 'mapbox-gl-utils-source' // CommonJS const utilsSource = require('mapbox-gl-utils-source') ``` ## 构建 出于你无法获取到 bundle 文件,或者想自己添加额外的地图服务资源等其它原因,你可以自己构建。 首先, `clone` 到本地 ```bash git clone https://github.com/wang1212/mapbox-gl-utils-source.git