更改 openlayers 中 feature.vector 的外观
我正在将代码从使用标记层转换为矢量图层。我在将地图上的标记显示为Feature.Vector 类时遇到问题(在我仅使用Feature 类之前)。
具体来说,我无法弄清楚如何使用我选择的不同图像来显示每个功能。我已经看到了一些如何使用样式图更改功能样式的示例,但我还没有看到直接设置功能图像的方法。
这似乎是一个简单的问题,但我还没有找到解决方案。我目前正在尝试使用样式属性:
var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(ll.lon, ll.lat), {externalGraphic: "http://www.openlayers.org/dev/img/marker.png"});
但是,这只会产生正常的默认图标(橙色圆圈)。
设置功能的 data.icon 和创建标记同样不起作用。
提前致谢!
I am transitioning my code from using a marker layer to a vector layer. I am having problems displaying markers on the map as a Feature.Vector class (before I used simply the Feature class).
Specifically, I cannot figure out how to display each feature with a distinct image that I choose. I've seen some examples of how to change the style of a feature in general using stylemaps, but I have not seen a way to directly set the image of a feature.
This seems to be a simple problem but I have not yet found the solution. I am currently trying to use a style property:
var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(ll.lon, ll.lat), {externalGraphic: "http://www.openlayers.org/dev/img/marker.png"});
However, this just results in the normal default icon (an orange circle).
Setting data.icon of the feature and creating a marker equally does not work.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将占位符放入由要素属性填充的图层样式中。
you put placeholders in the layer style which get populated by the features attributes.