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.

icon

Best answer by caracadrian 6 August 2020, 10:01

View original

11 replies

Badge +20

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

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

Badge +20

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...)

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.

Badge +20

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

Badge +20

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

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.

 

Badge +20

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

Badge +20

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

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

Badge +20

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

Anytime

Reply