Subscribe to this thread
Home - General / All posts - M9. Moving labels, possible typo error in the manual?
tonyw
533 post(s)
#11-Jul-19 07:55

I'm looking at the section on Labels http://www.manifold.net/doc/mfd9/index.htm#labels.htm

The manual suggests using CTRL-ALT-click to grab the position of the label (in either the label layer or label point drawing). Should it be SHIFT-ALT-click instead? Shift-Alt-click works for me while CTRL-Alt-click selects not the label position but the area and the label text.

The ability to store multiple GEOM fields in the same table is handy. I'm generally working with areas. My workflow to create and position the labels: I create a new geom field "label positions", use Transform to fill the new geom field with the area geoms. Then transform the new geom field from area to points. I have another field into which I have a computed expression to make up the area label. I'm working with 20-30 areas so the computation load of computed fields is negligible. I create a label component using the point geom field and the label field. Using Style, offset angle and point offset does the bulk of the positioning. Then using Shift-Alt-click, I can select and move the point controlling the label position. I would appreciate feedback on my workflow, maybe there is a more efficient procedure?

I can change information in any of the fields used to create the computed label expression. The expression in the label field updates automatically and the label text updates on the map. Very cool.

Screen shot shows the text where there may be the typo, CTRL-Alt-click instead of Shift-Alt-click.

Attachments:
Moving labels.JPG

tonyw
533 post(s)
#11-Jul-19 08:48

I thought I refined and eliminated a step today, but no, I still have to do one additional step, to create a new Label Position drawing based on the point geom. Then create the Label component based on the new Label Position drawing.Then I can reposition the labels with Shift-Alt-click then CTRL-Enter to save the change.

The above disassociates the label text from the original table. OK, so no progress afterall. If some part of the label text changes in the original table, I have to go through the process of re-creating the label drawing then the labels component, then manually reposition the labels again so that the labels are not directly over top of the areas. I'll explore relations between tables next.

Dimitri


5,491 post(s)
#11-Jul-19 12:53

The above disassociates the label text from the original table. OK, so no progress afterall. If some part of the label text changes in the original table, I have to go through the process of re-creating the label drawing then the labels component, then manually reposition the labels again so that the labels are not directly over top of the areas. I'll explore relations between tables next.

Well, no, you do have progress if what you want is to manually position labels derived from areas. If you want to do that and you also want automatic updates to label text, well, then you need some more progress. :-)

Labels created directly from areas are positioned by the system and not always at a centroid of the area. For example, when zoomed in so that some areas are only partially visible, the system will move labels into the part of the area that is visible, so more areas that are in view have labels.

If you want to change that you can decouple the geometry used to position the labels from the geometry of the area. The most common way of doing that is to create a point from the area, either manually or dynamically.

For example, you could add a Cent_Geom field to the table that is a computed field which generates the centroid of the area, and then create a drawing for those centroids and then a label from that centroids drawing. The labels will then always be at the centroid, but, because a computed field is read-only you won't be able to drag those points to some other position. However, if you add or delete areas, or if you edit areas to change their shape, the centroids will be automatically added/deleted/moved, as will any labels based on them.

Another way is to add a Points_Geom field (these names don't matter... I'm just making them up) to the table that is a Geom field, and to then use the Copy transform template using a centroids expression, like

GeomMakePoint(GeomCenter([Geom], 0))

to populate the Points_Geom field with the centroid of each area. This is a one-time deal, not a dynamic computed field.

You can then create a drawing from the Points_Geom field and create labels from that drawing. You'll now be able to move those labels around. If the text field in the table for the record (same record for the area and for the Points_Geom field) changes, the label text will change.

However, when creating points that way if you add an area there won't be a new point automatically created in the Points_Geom field. It will just be a NULL until you copy something into it.

If some part of the label text changes in the original table, I have to go through the process of re-creating the label drawing then the labels component,

That doesn't sound right if you did the last thing I suggested above.

Dimitri


5,491 post(s)
#11-Jul-19 15:32

New video showing how to do this: Custom Area Labels

tonyw
533 post(s)
#11-Jul-19 19:01

Thanks Dimitri, I think I got it now. The video is useful. I can select individual labels and reposition where the label falls as demonstrated in the video. And updating a field that makes up a label is conveyed to the label text visible in the map. An example was I number my areas and after some revisions I had two areas number #7. I updated the area numbering field which automatically updated the expression making up the label field. The updated area numbering appeared in the labels on the map. Nice.

My areas are small compared to the zoom level and text of the label. My areas are also distinct, stand-alone, they don't butt up together. I need the labels to be off to the side of the areas so that the label does not obscure the area. However I continually have to manually adjust the label position depending on the zoom level. Zoomed in, the labels are too far from the associated area. Zoomed out, the label sit overtop the associated areas so I manually move them further away. I will next try having two label drawings, one to position labels on small scale views (zoomed out) of maps, and a second label position drawing for larger scale (zoomed in) views of specific areas of maps.

The label option to offset (direction, points distance) helps but moves the labels all in the same direction and same distance. I still need some manual repositioning of the labels. What if there was another label position option. So a feature request. I don't have a one word name but it would be "position so as to not obscure the associated area or point". So if this option was enabled, the label position would become dynamic and off to the side and outside of the area or not on top of a point. The feature would also need to maximize the number of visible labels at any zoom level. It would be like offset but where M9 would choose the direction.

For a map like France in the video, there is enough room for labels within the areas that I would not enable this option to move labels to whatever side is appropriate so the area or point remains unobscured.

Dimitri


5,491 post(s)
#12-Jul-19 19:48

The label option to offset (direction, points distance) helps but moves the labels all in the same direction and same distance.

You can do style overrides to set all that per label.

tonyw
533 post(s)
#12-Jul-19 23:14

Thanks Dimitri. I'll try out Style Overrides. I see some possibilities when used in combination with thematic formatting, switching between the two and using Style Overrides to put emphasis on a particular object. For labels it seems positing labels is a trial and error effort with Style override (direction, distance), it seems easier to Shift-Alt-click the position of the label and drag it to a new position. I'll test some more.

Dimitri


5,491 post(s)
#11-Jul-19 12:32

Should it be SHIFT-ALT-clickinstead?

Yes, that's an error (an error also repeated when the topic talks about picking points to move them). It should be shift-alt-click. I've filed a bug report.

Alt-clicking picks an object to show it in the Record pane's Values tab, so you can see attributes.

Shift-alt-clicking picks an object and goes straight to the Coordinates tab of the record pane, so you can see the coordinates for the object and/or edit it.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.