本文介绍了如何在OpenLayers.Layer.Markers图层中移动标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式在OpenLayers.Layer.Markers层上移动现有标记?我似乎找不到合适的方法.

How can I programmatically move an existing marker on an OpenLayers.Layer.Markers layer? I can't seem to find a proper way.

这完全受支持吗?还是我必须使用Vector层?

Is this supported at all? Or do I have to use the Vector layer?

marker.moveTo()功能对我不起作用,我的坐标以经/纬度为单位.

The marker.moveTo() function doesn't work for me, I have the coordinate in lat/lon.

推荐答案

marker.moveTo()不是官方" APIMethod. OpenLayers中的其他方法在内部使用了它,实际上我们不鼓励您使用未标记为"APIMethod"的方法.

marker.moveTo() is not "official" APIMethod. It's used internally by other methods in OpenLayers and you are actually discouraged to use methods that are not marked as "APIMethod".

删除和添加新位置标记不会满足您的要求吗?有removeMarker()addMarker() APIMethods.

Wouldn't removing and adding marker on new position fulfill your requirement? There are removeMarker() and addMarker() APIMethods for that.

如果没有,我会考虑使用Vector图层,因为它在渲染和操作功能方面更加灵活.

If not, I would consider using Vector layer as it's much more flexible in terms om rendering and manipulation features.

这篇关于如何在OpenLayers.Layer.Markers图层中移动标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 19:01