Happy #MapInfoMonday,
Labels are always a good topic for an article on tips and tricks in MapInfo Pro. I have earlier discussed
how you can rotate labels and
how you can build more complex label expressions. Today, we will look at how you can extend the simple label capabilities for point layers by casting your point data to a region object which gives you more label capabilities.
We use the improved SQL capabilities to convert our point layer into a region layer using a simple buffer expression.
Labels for Point Layers
You can label points layers quite easily in MapInfo Pro. First, you enable
Autolabels for the layer using the
Layer Control, or
Layer List as we call it these days. And then you can modify the label settings using the
Label tab.
By default, labels are prevented from overlapping each other and so there is a number of points that do not get labeled.
MapInfo Pro has some options that let you label more points. In the example below, I have enabled the option
Try Other Locations which lets MapInfo Pro try out each of the 8-9 possible locations around the point to see if a label does fit in one of these locations without overlapping an existing label. This actually adds more labels to my map.
If you open up the Label Rules for a point layer, you can see that it only holds one option: Default Point Labeling. This is quite different for the region and line layers.
Let us check out the options for a region layer.
Converting a Point Layer to a Region Layer
First, we need to convert our point layer into a region layer. We can do this quite easily using the SQL window by adding a new object expression that we will use as the object for the query result.
Below you can see the resulting query added to our map window. The buffers appear as red circles around our initial points. The query I used look like this:
Select t.*, Buffer(t.obj, 8, 25, "m") object
From Fokuspunkter As "t"
Into _buffer
I select all the existing columns from my table
fokuspunkt
and I also add a derived spatial object:
Buffer(t.obj, 8, 25, "m")
. The buffer expression created 25-meter buffers around my points with a resolution of only 8 points for a full circle. I don't need a better resolution as my goal is just to get a region object that I will not display. I use the
object
keyword after this spatial expression to tell MapInfo Pro to use the derived spatial object for the query.
I have shown the buffer with a red line style above just to give you a visual representation to see. In the end, I will show these buffers with a not visible style as I only need them for labels.
Labels for Region Layers
Let us take a look at using these buffers for labeling. The default label settings for a region layer don't give me a much better result compared to the point layer. But I have more control of the labels now.
From the
Label Rules gallery, I can select between multiple options to see which options fit my data best. In my example, I select
Auto Position with Callout. One nice improvement with this option is that it adds a line from the label back to the inserting point. This makes it more clear what the labels refer to which can be hard to tell when the labels are positioned differently around the objects.
Also note that as you hover your mouse on top of the
Label Rules, MapInfo Pro updates the map temporarily so that you get an idea of the effect each rule will have on your map before actually applying the rule.
Once you are happy with the result, you can change the style override for the buffer to an invisible style like here below. And now it seems that the call-out points back to your initial points.
I hope this gave you some ideas on how you can improve your labels for points layers with a simple trick.
Are you have other general struggles with labels? Maybe we can look at some of these in an upcoming #MapInfoMonday article.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------