Closed tomchadwin closed 7 years ago
Hey @tomchadwin, no you can use other methods if you so wish :). At the time we struggled to find an example of being able to get vector labels and there bounds, but now there is an example on the official OpenLayers docs: https://openlayers.org/en/latest/examples/street-labels.html
Right, I saw that, but was struggling to unpick the Labelgun in that example from the other techniques it demonstrated (textpath
and label-segment
). I'll have another go.
This should be possible following there examples, albeit they are using an older version of labelgun (I need to send a PR to their docs). Sorry I can't be of more help right now regarding qgis2web. When I have some more time I will try and get a version working for you. Can you open up an issue on qgis2web for me to track? I'll close this for now as it's more a qgis2web issue as it stands.
I'm afraid I disagree. I'd say the labelling method I use above is the simplest and most frequently used OL technique. Without a bare-bones example, it's not going to get anything like as much usage as it deserves.
So, no SVG, no textpath, no label-segment. That's the example we need.
qgis2web issue is https://github.com/tomchadwin/qgis2web/issues/398.
I'll open the issue but can we rename it to be more specific to the exact technique you're using (I.e. Maybe the OL method name in question)? Also a code small snippet example of how you're doing labels would be great.
I can look into making a bare bones example in that case :)
I just published a new example using more idiomatic labelling: https://github.com/Geovation/labelgun/tree/master/docs/examples/openlayers4-vec
This looks absolutely perfect. I'll try it ASAP. Thanks!
This worked for me 100% - thanks so much. Very much appreciated. It's now hooked into qgis2web master:
https://github.com/tomchadwin/qgis2web/commit/d4ff58217826cb1a8e14153b107ddc2f483de8ce
Without Labelgun, I label OL features as follows:
The Labelgun OL4 examples seems to write the text into an SVG:
Is this a prerequisite for Labelgun in OL4, or could it be applied to my existing labelling method?