Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎样显示geojson中的区域名称? #23

Open
DuShuYuan opened this issue Feb 17, 2022 · 2 comments
Open

请问怎样显示geojson中的区域名称? #23

DuShuYuan opened this issue Feb 17, 2022 · 2 comments

Comments

@DuShuYuan
Copy link

比如加载以下json只有线,怎样显示“北京市”文字?properties.name 字段

{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"adcode": 110000,
"name": "北京市",
"center": [
116.405285,
39.904989
],
"centroid": [
116.41995,
40.18994
],
"childrenNum": 16,
"level": "province",
"parent": {
"adcode": 100000
},
"subFeatureIndex": 0,
"acroutes": [
100000
]
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[

@DuShuYuan
Copy link
Author

设置了对应属性 showCenterLabel: true, centerLabelPropertyName,没有效果
defaultStyle: {
outlineColor: 'rgb(255,0,0)',
lineWidth: 1,
fill: false,
tileCacheSize: 200,
showMaker: true,
showCenterLabel: true,
pointSize: 15,
ringRadius: 10,
fontColor: 'rgba(255,0,0,1)',
fontSize: 18,
labelOffsetX: -10,
labelOffsetY: -5,
showLabel: true,
showMarker: true,
labelPropertyName: 'name',
centerLabelPropertyName: 'name'
},

@MikesWei
Copy link
Owner

showCenterLabel只对多边形有效。建议单独使用点数据集显示标注

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants