kikitte/MVTImageryProvider

标注时不能渲染中文字符

LDGWHU opened this issue · 3 comments

屏幕截图 2022-08-23 153912
在使用时发现不能正常显示中文标注,不知是否配置正确。可以显示数字、英文,但是不显示中文字符,矢量瓦片服务互联网可以访问,配置如下
var style = {
version: 8,
name: "Light",
center: [106.387482, 29.787025, 17],
zoom: 0,
bearing: 0,
pitch: 0,
sources: {
layer_source: {
// scheme: "tms",
tiles: [
"http://zhsq.digitalcq.com/d2cpro/tileservice/dt_65poi_2sources_xianmian/{z}/{x}/{y}.mvt",
],
type: "vector",
},
},
glyphs: "http://zhsq.digitalcq.com/d2cpro/oms/static/fonts/font_1514359479/{fontstack}/{range}.pbf",
layers: [
{
id: "填充",
type: "fill",
source: "layer_source",
"source-layer": "dbsj_fwjz_csjz_jzjz_py",
minzoom: 0,
maxzoom: 18,
paint: {
"fill-color": "#66CCFF",
"fill-opacity": 0.7
},
},
{
"id": "注记",
"type": "symbol",
"minzoom": 0,
"source": "layer_source",
"source-layer": "dbsj_fwjz_csjz_jzjz_py",
"layout": {
"text-font": ["Open Sans Regular"],
"text-field": "{jzwmc}",
"text-max-width": 8,
"text-size": 12,
"text-allow-overlap": true
},
"paint": {
"text-color": "#ff0000",
"text-halo-width": 1,
"text-halo-color": "rgba(255,255,255,0.5)"
}
}
],
};

场景位置:
cesiumViewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(106.54, 29.59, 2000.0),
orientation: {
heading: Cesium.Math.toRadians(0.0),
pitch: Cesium.Math.toRadians(-90.0),
roll: 0.0
}
});
结果如截图,麻烦指教

字体问题,所给样式中 "text-font": ["Open Sans Regular"], 该字体不支持中文所以显示不了,将其删除或者注释之后将会使用系统字体渲染,就正常了。
image

非常感谢

@LDGWHU 你好,在Cesium中使用该插件,你获取到对应选中位置的矢量数据时,是通过pickFeatures()函数数据属性广播出来的?这个选中区域如何实现选中变色?