ImageSource

图片数据源。 继承至Evented


示例

// 图片添加到地图
map.addSource('some id', {
   type: 'image',
   url: 'http://www.dituyi.com.cn/examples/wmapgl/img/cat.png',
   coordinates: [
       [-76.54, 39.18],
       [-76.52, 39.18],
       [-76.52, 39.17],
       [-76.54, 39.17]
   ]
});

// 设置空间坐标
var mySource = map.getSource('some id');
mySource.setCoordinates([
    [-76.54335737228394, 39.18579907229748],
    [-76.52803659439087, 39.1838364847587],
    [-76.5295386314392, 39.17683392507606],
    [-76.54520273208618, 39.17876344106642]
]);

// 更新图片和坐标
mySource.updateImage({
   url: 'http://www.dituyi.com.cn/examples/wmapgl/img/cat.png',
   coordinates: [
       [-76.54335737228394, 39.18579907229748],
       [-76.52803659439087, 39.1838364847587],
       [-76.5295386314392, 39.17683392507606],
       [-76.54520273208618, 39.17876344106642]
   ]
})

// 删除图片
map.removeSource('some id');  // remove

方法

方法 返回值 描述
updateImage(options) this options包括必要的url和coordinates属性
setCoordinates(Array< Array< number>>) this 设置坐标

results matching ""

    No results matching ""