Appearance
瓦片源
瓦片源可单独使用(自行 new TileLayer({ source })),也是 createBaseLayer 内部使用的构件。使用前需先 registerProjections()(new GMap() 已自动调用)。
GaodeSource
继承
ol/source/XYZ(GCJ-02 投影)。
ts
new GaodeSource({ style: 'vec' }); // 公网
new GaodeSource({ url: 'http://host/gd/{z}/{y}/{x}.png' }); // 离线构造选项 GaodeSourceOptions(继承 ol/source/XYZ 的 Options),新增 style?: 'vec' | 'sat'(默认 vec)。常量 GAODE_ATTRIBUTION。
BaiduSource
继承
ol/source/XYZ(BD-09 投影)。
构造选项 BaiduSourceOptions,新增 style?: 'vec' | 'sat'。常量 BAIDU_ATTRIBUTION。
百度墨卡托瓦片 y 轴方向与 ol 相反,内部已做
-y-1翻转。createBaiduUrlFunction(urlTemplate: string) => UrlFunction—— 按模板(含{x}/{y}/{z}/{s})构造百度瓦片地址函数,路况等场景复用。
TiandituSource
继承
ol/source/XYZ。
ts
new TiandituSource({ token: 'xxx', layerType: 'vec', projectionType: 'w' });构造选项 TiandituSourceOptions(继承 ol/source/XYZ 的 Options),新增:
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
token | string | 必填 | 天地图开发者 token |
layerType | TiandituLayerType | 'vec' | vec矢量 / cva矢量注记 / img影像 / cia影像注记 |
projectionType | TiandituProjection | 'w' | w = EPSG:3857,c = EPSG:4326 |
常量 TIANDITU_ATTRIBUTION。
OceanSource
继承
ol/source/XYZ(EPSG:3395 海图墨卡托)。
构造选项继承 ol/source/XYZ 的 Options(默认船讯网公网海图,url 可覆盖)。常量 OCEAN_ATTRIBUTION。
SuperMapRestSource
继承
ol/source/TileImage。
超图 iServer REST 瓦片源。构造选项 SuperMapRestOptions(继承 ol/source/TileImage 的 Options),新增:
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
sourceUrl | string | — | iServer 服务地址(…/rest/maps/{mapName}) |
format | string | 'png' | 瓦片格式 |
serverType | string | 'ISERVER' | 服务类型 |
extent | Extent | — | 数据范围 |
tileProxy | string | — | 瓦片代理前缀 |
redirect / transparent / cacheEnabled / prjCoordSys / layersID / overlapDisplayed / tileversion | iServer 请求参数 |
getTileGrid
按投影代号获取默认瓦片网格。
ts
import { getTileGrid } from 'geoverse';
const grid = getTileGrid('BD:09');签名:getTileGrid(code: GridCode): TileGrid
GridCode:'GCJ:02' 'BD:09' 'EPSG:3857' 'EPSG:4326' 'EPSG:4490'。