Skip to main content
Solved

Align label with line


@takashi

Hi !

Any hints how to align label with the line direction ? I'm using a 2DVectorCalculator, Featuremerger, offsetter and vertex creator. But I'm not always having the right orientation of my labels with the line direction. See below attached images. Thank you in advance.

Best answer by caracadrian

caracadrian wrote:

The Forum becomes Read only in a few minutes (https://knowledge.safe.com/questions/117555/important-notice-community-migration-service-outag.html ) so email me at if you have further questions

@sam.27​ You should start with the ProfileGenerator custom transformer, right click it and than click edit. Copy paste everything in your workspace, than customize to your needs.

Customise ProfileGenerator

The red bookmark that I created is an idea of what you need. You label the vertexes and offset them with something constant (constant + z*VerticalExageration - or @YValue*VerticalExageration).

For partial distances you Chop by 2 vertexes, generate the 2D measure of each line, label it and offset that label to the place you need it to be.

Please mark the question as answered, I want to know what the new badges look like :D

View original
Did this help you find an answer to your question?

11 replies

caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • July 28, 2020

Can you tell us what are you trying to label?

For line labeling you can use the Labeller transformer.

For labeling points with the orientation of the line you can also use the NeighborFinder to get the angle and than the LabelPointReplacer


  • Author
  • July 28, 2020

I'm labelling the attribute showing depth at each vertex.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • July 28, 2020

You can get something like this:with this:

I input a 3Dpolyline that I chop in to vertexes than I get their neighbor, label the vertexes and set their rotation via the fme_rotation attribute.

If you want to set the rotation to the angle of the line that goes from the previous vertex to the next vertex you can create attributes for X and Y, than Enable adjacent feature attributes in an AttributeManager and do the math (atan(dX/dy) plus or minus depending on x and y grater than or less than 0, you have 4 situations. Don't forget about pi()/180...)


  • Author
  • July 28, 2020

Oh great! It works very well ! Thank you.

I have another question, do you know if it is possible to create label shown in rectangle from the figure below: It's a DWG file.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • July 28, 2020
sam.27 wrote:

Oh great! It works very well ! Thank you.

I have another question, do you know if it is possible to create label shown in rectangle from the figure below: It's a DWG file.

Sure, just use a lot of LabePoinReplacers coupled with Offseters, get the BoundingBox, draw the line.

Here is a demo workspace labelpointinbox.fmwt


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • July 28, 2020
sam.27 wrote:

Oh great! It works very well ! Thank you.

I have another question, do you know if it is possible to create label shown in rectangle from the figure below: It's a DWG file.

The Forum becomes Read only in a few minutes (https://knowledge.safe.com/questions/117555/important-notice-community-migration-service-outag.html ) so email me at if you have further questions


  • Author
  • August 6, 2020
caracadrian wrote:

The Forum becomes Read only in a few minutes (https://knowledge.safe.com/questions/117555/important-notice-community-migration-service-outag.html ) so email me at if you have further questions

Hi Adrian,

Thanks a lot, I've added a buffer to keep the characters inside the label not too close to the border!

Could you please help me with another Issue, I need to make an elevation profile of a pipeline like in the attached dgn file.

Thanking you in advance.

 


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • August 6, 2020
caracadrian wrote:

The Forum becomes Read only in a few minutes (https://knowledge.safe.com/questions/117555/important-notice-community-migration-service-outag.html ) so email me at if you have further questions

@sam.27​ You should start with the ProfileGenerator custom transformer, right click it and than click edit. Copy paste everything in your workspace, than customize to your needs.

Customise ProfileGenerator

The red bookmark that I created is an idea of what you need. You label the vertexes and offset them with something constant (constant + z*VerticalExageration - or @YValue*VerticalExageration).

For partial distances you Chop by 2 vertexes, generate the 2D measure of each line, label it and offset that label to the place you need it to be.

Please mark the question as answered, I want to know what the new badges look like :D


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • August 6, 2020
caracadrian wrote:

The Forum becomes Read only in a few minutes (https://knowledge.safe.com/questions/117555/important-notice-community-migration-service-outag.html ) so email me at if you have further questions

Meh.. I liked the old forum badges better


  • Author
  • August 6, 2020

🙂 Thanks again for your help ! Have a nice day Adrian !


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • August 6, 2020
sam.27 wrote:

🙂 Thanks again for your help ! Have a nice day Adrian !

Anytime


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings