How to move a marker in an OpenLayers.Layer.Markers layer?

后端 未结 3 911
醉话见心
醉话见心 2021-01-20 21:28

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

Is this supported at all? O

3条回答
  •  礼貌的吻别
    2021-01-20 22:07

    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".

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

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

提交回复
热议问题