a couple of ideas:
If you are writing to a format that supports text justification, you can try to manipulate the corresponding format attributes.
Itay
You can center your text by finding its insertion point and orientation in relation to the streetgeometry.
For this i do something like this:
1. Strroke the text.
2 deaggregate it, with setting to split surfaces/solids.
3 Boundingboxaccumulater.
4 from bounind boxaccumulator you can extract all data u need.
Hi all.
To do that i do something like:
1. stroke text
deaggregate it, with setting split surfaces/solids.
boundingboxaccumulator (no group by)
from resulting bounding box u get centerline, centerpoint, orientation and insertionpoint (wich is left bottomcorner of BB).
2. with the line and orientation u can aquire inersections with streetboundary if you have them as polygons.
if you already have streetcenterlines (axis) you can just affine/move center of bounding box to intersection of axis with centerline of boundingbox.
You can also test wether the text fits into the street and recalculate if needed fontsize if needed or make it multiline.
You will end up with insertionpoints for your text. The stroked text is just for calculationpurposes. (unless you want to "flow" your text. This i do with the stroked fonts)
Have fun.
I solved 95% of the problem.
I did these steps:
20 x 1.5 = 30
Black text: New street name
Red text: Old street name
Green point: Street center point
Purple line: Street bound
Brown line: Street
@David: CentredLabelAdder works! (;
@Itay: It does not work for me, because I did not have the street. I create this using the street (feature) + Labeller (I tested in Smallworld GUI and set center align for the annotation).
@Gio: I need the text feature, TextStroke transforms text into line feature.
Thanks all for help!!!
But still retain retain text, its just an attribute u can acces and turn to a textobject whenever u want, and of course insertion point and boundingboxes fo desired font. No data need to be lost in this proces.
My script was more concerned to "flow" text along lines and fit em snugly in steetpolys.
Also, graphical generation is faster then text btw.
2012 doenst have a centredlabeler (afaik). And only part of Leiden (where i live) street geometry has symetrical streets anyway.
Fitting streetname on crossection of a street is not very usefull on our maps.