I've got a Linestrings layer.
Each Linestring has among other fields, these ones:
id ENTRY EXIT
1 S1 E2
2 S1 E3
3 S1 E3
4 S1 E3
5 S1 E3
6 S1 E1
7 S1 E3
8 S1 E2
9 S2 E5
10 S2 E3
11 S1 E1
12 S1 E1
13 S3 E4
14 S1 E2
15 S1 E1
I want to show for each Linestring, the ENTRY value as a label at the beginning of the Linestring and the EXIT value at the ending.
I am using the following solution suggested by @Spacedman here:
You can do this with two "Rule-based Labelling" labels, with no filters. This lets you put multiple labels on a feature. The first rule labels the feature with the attribute you want at the start, the second rule with the end attribute. Initially your labels will appear in the centre of the line, so we need to fix that. Do that with "data defined" expressions for the position. Use the drop-down and hit "Edit...". For the label at the start, use x_at(0) and y_at(0) for the position expressions. For the end label, use x_at(-1) and y_at(-1).
The thing is that if I place each label exactly at the beginning and ending points of a Line, as @Spacedman suggets, some ENTRY and EXIT labels get overlapped (and can't be seen) because some Lines share start/end points.
So, the idea then would be to place each ENTRY/EXIT label a little bit displaced to the inside of the Line and not exactly on the end/beggining point?
Result should be something like:
Something like postgis' ST_Line_Interpolate_Point function would be great in this case, but in qgis...
No comments:
Post a Comment