THING.EARTH.VectorTileLayer(param)

矢量切片图层

new VectorTileLayer(param)

Parameters:
Name Type Description
param Object 参数列表
Properties
Name Type Attributes Default Description
tileExtendNum Number <optional>
1 瓦片扩展范围
maxTileFactor Number <optional>
12 从屏幕中心到边缘请求的瓦片个数上限
url String 矢量瓦片地址
vectorLayers Array 矢量切片配置
resourcePrefix String 资源的相对地址,同map的resourcePrefix传参,如果样式配置是绝对地址,就不用用这个
sourceCrs String 矢量切片数据本身的坐标系
targetCrs String 渲染时要使用的坐标系 如果需要转换坐标系,就需要同时设置sourceCrs,targetCrs
visible Boolean <optional>
true 是否可见
filterArea Array <optional>
剪裁范围(geojson中的Polygon或者MultiPolygon格式的coordinates)
tag Boolean <optional>
标识 用作模板效果
Author:
  • caihuimin
  • huyang
Example
const layer = new THING.EARTH.VectorTileLayer({
    "url": "http://192.168.21.57:5204/vector-all-g-1-bu/{z}/{x}/{y}?schema=xyz",
    "resourcePrefix": "http://192.168.21.5:7000/sf/mapDemo/tp_dabiaojie/",
    "vectorLayers": [
      {
        "layerLabel": "一般水域",
        "name": "Water",
        "vectorLayerName": "geo_water_norm_area",
        "layers": [
          {
            "visibleLevel": [
                13,
                22
            ],
            "fetchLevel": 13, //从多少级别开始显示
            "thinningMod": null, // 抽稀系数 1代表全抽稀 2代表抽稀1/2 3代表抽稀1/3(保留2/3)
            "config": { //与图层的构造函数参数格式一致
                "renderOrder": -38,
                "labelId": 7,
                "offsetHeight": 0,
                "style": {
                    "color": "rgb(27,129,167)",
                    "speed": [1,1],
                    "normal":{
                      url:"/image/waternormals.jpg"
                    }
                    "opacity": 1,
                },
                "type": "FeatureLayer",
                "geoObjectType": "GeoWater"
            }
          }
        ]
      }
    ]
  })

Members

filterArea :Object

设置/获取 剪裁的几何范围(符合geojson标准的Polygon或者MultiPolygon坐标)

maxTileFactor :Number

设置/获取 从屏幕中心到边缘请求的瓦片个数上限

vectorLayers :Array.<Object>

设置/获取 矢量切片图层的配置

Methods

gc(force)

清理非视野范围内的瓦片,释放内存

Parameters:
Name Type Description
force Boolean 是否强制清理,默认为false,瓦片数量不多的时候不清理
Author:
  • huyang

updateSubLayerVisible(layerName, visible)

设置子图层的可见性.

设置子图层的可见性
Parameters:
Name Type Description
layerName String 子图层名称 与初始化传入vectorLayers中的name一致
visible Boolean 是否可见
Author:
  • huyang
Example
layer.updateSubLayerVisible('Water',false);//隐藏矢量切片中的水

updateVectorLayers(vectorLayers, resourcePrefix)

Parameters:
Name Type Description
vectorLayers Object 矢量图层配置,同构造参数中的 vectorLayers
resourcePrefix String 资源的相对地址,同map的resourcePrefix传参,如果没有改变,可以不传
Author:
  • caihuimin