# types-leaflet.chinatmsproviders **Repository Path**: twoke/types-leaflet.chinatmsproviders ## Basic Information - **Project Name**: types-leaflet.chinatmsproviders - **Description**: leaflet.chinatmsproviders 插件的typescript类型支持 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-13 - **Last Updated**: 2025-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # @types/leaflet.chinatmsproviders ## 介绍 leaflet.chinatmsproviders 插件的typescript类型支持 ## 安装教程 ```shell pnpm add -D types-leaflet.chinatmsproviders ``` ```shell npm install -D types-leaflet.chinatmsproviders ``` ## 使用说明 ### tsconfig.json 添加定义 ```json { "compilerOptions": { /* Linting */ "types": [ /* Leaflet.chinatmsproviders */ "types-leaflet.chinatmsproviders/client" ] } } ``` ### 使用leaflet.chinatmsproviders ``` import L from 'leaflet'; // 添加上面的types就可以通过ts校验 L.tileLayer.chinaProvider('Baidu.Satellite.Map').addTo(map); ``` 由于chinatmsproviders并没有针对gcj02和bd09地图偏移问题进行处理,需要这方面支持的请前往[leaflet.mapCorrection](https://github.com/gisarmory/Leaflet.InternetMapCorrection/blob/master/src/leaflet.mapCorrection.js) 类型定义中也对leaflet.mapCorrection进行了定义,在使用自定义瓦片数据(gcj02/bd09)时,需要进行地图瓦片修正,可配置以下参数:(前提是安装了leaflet.mapCorrection插件) ``` L.tileLayer.chinaProvider('https:/xxxx/{z}/{x}/{y}.png', { corrdType: 'gcj02' // 'gcj02' | 'bd09' | 'wgs84' 默认值是undefined,也就是默认就是leatlet自带的wgs84坐标系,不需要纠正坐标 }) .addTo(map); ```