Skip to main content
Question

Change label position to labelpoint


Forum|alt.badge.img

When creating a label with the Labeller or LabelPointReplacer, a labelpoint is made at the asked position. However, the label itself is always placed on the right above position from the labelpoint.

I need the label to be placed on the left above position from the labelpoint (thus having the point at the end of the labeltext instead of the beginning), in order to garentee a good label fit in the end result. How would this be possible?

7 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+34

Have you tried the Labeller instead? It gives a little more control over placement


Forum|alt.badge.img
  • Author
  • August 24, 2018
virtualcitymatt wrote:

Have you tried the Labeller instead? It gives a little more control over placement

Yes, it places a labelpoint at the specified place and rotation. However, the text will still be right above the labelpoint, cfr. the rotation.

 

 


Forum|alt.badge.img
  • Author
  • August 24, 2018

After a some more research I found this: https://knowledge.safe.com/articles/16546/text-justification.html

However, I am writing to PDF2D, which is not in the table. Any other options?


virtualcitymatt
Celebrity
Forum|alt.badge.img+34
bakkermans wrote:

After a some more research I found this: https://knowledge.safe.com/articles/16546/text-justification.html

However, I am writing to PDF2D, which is not in the table. Any other options?

You could always offset the text with an Offsetter. The text has a defined bounding box. You can extract the xmin and xmax with a BoundsExtractor, get the difference and then offset by the negative difference. The issue that I see with this method is that the 'bounds' might not be an accurate reflection of how the text will look in the PDF. It's worth giving it a go just to see.

 

Perhaps @DaveAtSafe has a better idea?

 

There is always the MapTextLabeller plugin....handy tool but not free. Perhaps you can get a trial of it to see if it's worth the investment?

 

 


Forum|alt.badge.img
  • Author
  • August 24, 2018
virtualcitymatt wrote:
You could always offset the text with an Offsetter. The text has a defined bounding box. You can extract the xmin and xmax with a BoundsExtractor, get the difference and then offset by the negative difference. The issue that I see with this method is that the 'bounds' might not be an accurate reflection of how the text will look in the PDF. It's worth giving it a go just to see.

 

Perhaps @DaveAtSafe has a better idea?

 

There is always the MapTextLabeller plugin....handy tool but not free. Perhaps you can get a trial of it to see if it's worth the investment?

 

 

I have spent already a lot of time experimenting with bounding boxes and offsetters. The result however is just not correct enough to be used as a generic solution, because of these inaccurate bounds.

 

 


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • August 24, 2018
bakkermans wrote:
I have spent already a lot of time experimenting with bounding boxes and offsetters. The result however is just not correct enough to be used as a generic solution, because of these inaccurate bounds.

 

 

Hi @bakkermans,

 

The most accurate way to get the bounds of a text feature is to use the TextStroker to convert it to an aggregate polygon, using the appropriate font, then get the bounds of the aggregate.

 

If the label is rotated, use the Rotator to rotate it to horizontal before stroking.

 


Forum|alt.badge.img
  • Author
  • August 27, 2018
daveatsafe wrote:
Hi @bakkermans,

 

The most accurate way to get the bounds of a text feature is to use the TextStroker to convert it to an aggregate polygon, using the appropriate font, then get the bounds of the aggregate.

 

If the label is rotated, use the Rotator to rotate it to horizontal before stroking.

 

I already tried that earlier on as a possible solution, however still without the right accuracy as a result. I suppose then there is nothing else to do about this?

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