我们的目标是创建尽可能轻量级的Geo-json。为了实现这一点,我们正在使Geo-json属性、键和值尽可能地小。
发自:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": []//coordinates
},
"properties": {
"rotation": 0, //<-- Notice Keys
"size": 0.609524,
"text": "143",
"text-justify" : "left"
}
},至
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": []//coordinates
},
"properties": {
"r": 0,
"s": 0.609524,
"t": "143",
"tj": "l" //"l" is "left", "r" is right and "c" is center
}
},然后在前端添加图层时,会做如下所示:
"layout": {
"text-justify": ['get', 'tj'] //<--- How to create this expression
"text-field": ['get', 't'],
"text-size":
[
'interpolate',
['exponential', 1.75],
['zoom'],
1, ["/", ["get", "s"], 5.15],
11, ["/", ["get", "s"], 0.01]
],
"text-rotate": ['get', 'r'],
}所以我的问题是:当"l"/"r"/"c“的值是”左“/”右“/”中“时,如何为”文本对齐“属性编写表达式?
发布于 2020-09-22 08:08:27
你可以这样写它:
"text-justify": ['match', ['get', 'tj'],
'l', 'left',
'r', 'right',
//...
'center'
]如果您的目标是静态地将大型数据文件发送到浏览器,那么您可能希望将Geobuf视为一种更节省空间的格式。
https://stackoverflow.com/questions/63986514
复制相似问题