Openlayers 4的标注方法
Labeling method for Openlayers 4
我不是网络开发专家。我使用 Openlayers 4 制作了一个网络地图,但我对复杂矢量特征的标记有疑问。
我想显示属于特定组的道路的标签。
网络地图模型为HERE and the GeoJson line vector is HERE。
当我使用此代码(webmap 模型)时,我从 FireFox 收到此错误并且 Chrome:
ReferenceError: style is not defined[Learn More] test.html:37:43
如何解决这个问题?
您正在使用一个不存在的 style
变量。您还犯了一些图层顺序错误。
我已经 a demo with corrections 完成了您的示例工作。
样式的修复主要是由于将 stradario_provincialiStyle
更改为样式然后在 ol.layer.Vector
的选项 style
中重新使用它。
我不是网络开发专家。我使用 Openlayers 4 制作了一个网络地图,但我对复杂矢量特征的标记有疑问。
我想显示属于特定组的道路的标签。
网络地图模型为HERE and the GeoJson line vector is HERE。
当我使用此代码(webmap 模型)时,我从 FireFox 收到此错误并且 Chrome:
ReferenceError: style is not defined[Learn More] test.html:37:43
如何解决这个问题?
您正在使用一个不存在的 style
变量。您还犯了一些图层顺序错误。
我已经 a demo with corrections 完成了您的示例工作。
样式的修复主要是由于将 stradario_provincialiStyle
更改为样式然后在 ol.layer.Vector
的选项 style
中重新使用它。