By David Crowther
Question:
How can you label features in MapThat?
Answer:
Previously Label Type layers were used as a Parent to group similar child Layers.
For example, in this MapThat project we created a PARENT Group called SQL SPATIAL DATASETS and Under that PARENT Group, there are 3 Child Layers. This is a good way to sub divide multiple layers under the overall Layer Header called Liverpool Planning Data, making it easier for users to find their data.
Historically, in MapThat these PARENT Groups were created as a LABEL TYPE layer within your MapThat Admin Forms, but we have now renamed any existing LABEL Type Layers to be called PARENT layers. They still provide the same function – they act a PARENT to group similar child layers.
This means the LABELS Type Layer has now been freed up to act as LABELS!
A LABELS Layer will now be like a DATAPOINT Layer, as it will use the source data’s X and Y columns to place a label on the map. Here are some examples:
Ward Labels:
Labels are not part of an existing Layer, they are in fact their own Layer. This means that the user can choose to display a layer (Spatial or DataPoint Type) e.g. Wards without labels.
The Labels for this layer will then be added as a separate Layer (LABEL TYPE) which the user can choose to display or hide.
To create this Label Layer, in the MapThat Admin Forms, simply clone the existing Wards Layer and then change the LAYER TYPE = LABELS.
The Labels need to be placed at a location and this is determined using the Longitude and Latitude options. For a spatial (or datapoint) layer that is WGS84/4326 choose the Longitude and Latitude fields, and for a BNG/27700 table choose the Easting and Northing fields.
The Stroke Colour, Fill Colour, Line Thickness in the LABELS Layer will control the TEXT Label style in the map…. not the style of the Ward Polygons,.. as these are stored in another layer.
Other options will be added to the MapThat Admin Forms soon, such as the TEXT SIZE, TEXT FONT… and the default field to label with.
Once the LABELS Type layer is created it can be added to the Project and the user can display it!
If you have difficulties finding the X and Y fields for your data, here is some SQL that will extract it for you:
update wards set easting = ogr_geometry.STCentroid().STX
where easting is NULL
update wards set northing = ogr_geometry.STCentroid().STY
where northing is NULL
School Labels:
You can also label Point Layers. Again, the LABEL TYPE layer doesn’t show the actual Point geometry, it renders a TextMarker object, using a value from a field in the source table as the label and then positions the label using the X and Y values in the source data.
If you want your Labels to be offset from the actual Point object, then you can create 2 extra fields to store an offset X and Y value.
update edubase set easting_label = easting + 5
update edubase set northing_label = northing – 5
Now, when you apply the new easting_label and northing_label values to your LABEL Layer, the labels will show as offset from the actual point location!
Currently when the user ticks to display a LABEL Layer they are asked which field to label the layer with and they type the name of the field from the source data to apply their preferred labels.
This will be a configurable item per layer, so the Admin User can (if they wish) choose a default field to label with, or you can choose to continue to allow the user to choose for themselves.
Watch out for future options for labelling in MapThat or please feel free to send us some suggestions of your own!
Comments (0 comments)