Reputation: 2677
It is possible to define an offset for ol.style.Text
instances (offsetX
and offsetY
properties) and define a custom anchor for ol.style.Icon
instances. This functionality is not present neither in ol.style.Circle
nor ol.style.RegularShape
.
I need to draw my features as four shapes (triangles, circles, ...) with proper offsets so that they won't overlap and will be rendered completely.
E.g. x
is the true coordinate of a feature and the four O
s are four circles of different colors. Each represents a value of an attribute and I need to color them dynamically depending on the value.
O O
x
O O
What is the best way to implement offsets? Is it possible to extend existing prototypes in some future-proof way? Or should I write my own style from scratch (I'd like to reuse as much of existing OL-3 code as possible)? Or is it better to use four ol.style.Icon
s with different anchors?
Upvotes: 5
Views: 1269
Reputation: 5647
The most future proof way would be to contribute this improvement to OpenLayers. It should be quite easy to implement - the anchor
option could be exposes more or less the same way it is done in ol.style.Icon
.
To get started with contributing to OpenLayers 3, I'd recommend to read https://github.com/openlayers/ol3/blob/master/CONTRIBUTING.md.
Upvotes: 1