types-leaflet.chinatmsproviders
v1.0.1
Published
leaflet.chinatmsproviders 插件的typescript类型支持
Downloads
7
Maintainers
Readme
@types/leaflet.chinatmsproviders
介绍
leaflet.chinatmsproviders 插件的typescript类型支持
安装教程
pnpm add -D types-leaflet.chinatmsprovidersnpm install -D types-leaflet.chinatmsproviders使用说明
tsconfig.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
类型定义中也对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);