Closed benams closed 4 years ago
https://openlayers.org/en/latest/examples/vector-labels.html
I've seen this example, but I can't understand how I can "translate" it from JS to VueLayers
<vl-layer-vector>
<vl-source-vector :features="features" />
<vl-style-func :factory="styleFunctionFactory" />
</vl-layer-vector>
function styleFunctionFactory () {
const baseStyle = {
textFontSize: 12
}
const cache = {}
return (olFeature, resolution) => {
const featureId = olFeature.getId()
if (!cache[featureId]) {
cache[featureId] = [createStyle({
...baseStyle,
text: olFeature.get('some_text')
})]
}
return cache[featureId]
}
}
Hi @benams ,
I can only add to @become-iron example that you can find createStyle
helper in vuelayers/lib/ol-ext
module.
This helper not from ol
package.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I need to have the country names on a simple vector layer:
I need to add an extra layer? any other way to do it?