Skip to main content
edited body
Source Link
ahmadhanb
  • 41.4k
  • 5
  • 54
  • 109

If you want to place the label at the start of the line, try to use the following formula for x coordinate:

x_at(0)

And use the following formula for y coordinate:

y_at(0)

To align the labels at the center of the circle in your example, you need to use the Alignment horizontal and vertical:

enter image description here

In alignment horizontal write 'Center', and alignment vertical write 'Half'. youYou will get the following result, which is exactly what you need:

enter image description here

If you want to place the label at the start of the line, try to use the following formula for x coordinate:

x_at(0)

And use the following formula for y coordinate:

y_at(0)

To align the labels at the center of the circle in your example, you need to use the Alignment horizontal and vertical:

enter image description here

In alignment horizontal write 'Center', and alignment vertical write 'Half'. you will get the following result, which is exactly what you need:

enter image description here

If you want to place the label at the start of the line, try to use the following formula for x coordinate:

x_at(0)

And use the following formula for y coordinate:

y_at(0)

To align the labels at the center of the circle in your example, you need to use the Alignment horizontal and vertical:

enter image description here

In alignment horizontal write 'Center', and alignment vertical write 'Half'. You will get the following result, which is exactly what you need:

enter image description here

Post Undeleted by ahmadhanb
added 18 characters in body
Source Link
ahmadhanb
  • 41.4k
  • 5
  • 54
  • 109

If you want to place the label at the endstart of the line, try to use the following formula for x coordinate:

x(end_point(centroidx_at($geometry ))0)

And use the following formula for y coordinate:

y(end_pointy_at($geometry )0)

Please noteTo align the above formula will work whenlabels at the line is in vertical orientation, as in your case.

But ifcenter of the line iscircle in horizontal orientationyour example, you shouldneed to use centroid in y coordinate not in x, as follows:

x---->the x(end_point($geometryAlignment ))horizontal and vertical:

y---->enter image description here

In alignment y(end_point(centroid($geometry )))horizontal write 'Center', and alignment vertical write 'Half'. you will get the following result, which is exactly what you need:

enter image description hereenter image description here

If you want to place the label at the end of the line, try to use the following formula for x coordinate:

x(end_point(centroid($geometry )))

And use the following formula for y coordinate:

y(end_point($geometry ))

Please note the above formula will work when the line is in vertical orientation, as in your case.

But if the line is in horizontal orientation, you should use centroid in y coordinate not in x, as follows:

x----> x(end_point($geometry ))

y----> y(end_point(centroid($geometry )))

enter image description here

If you want to place the label at the start of the line, try to use the following formula for x coordinate:

x_at(0)

And use the following formula for y coordinate:

y_at(0)

To align the labels at the center of the circle in your example, you need to use the Alignment horizontal and vertical:

enter image description here

In alignment horizontal write 'Center', and alignment vertical write 'Half'. you will get the following result, which is exactly what you need:

enter image description here

Post Deleted by ahmadhanb
Source Link
ahmadhanb
  • 41.4k
  • 5
  • 54
  • 109

If you want to place the label at the end of the line, try to use the following formula for x coordinate:

x(end_point(centroid($geometry )))

And use the following formula for y coordinate:

y(end_point($geometry ))

Please note the above formula will work when the line is in vertical orientation, as in your case.

But if the line is in horizontal orientation, you should use centroid in y coordinate not in x, as follows:

x----> x(end_point($geometry ))

y----> y(end_point(centroid($geometry )))

enter image description here