• Blog posts

    Bio

    By David Crowther

    MapThat___Creating_Label_Layers_-_1.PNG

    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.

    MapThat___Creating_Label_Layers_-_2.PNG

    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.

    MapThat___Creating_Label_Layers_-_3.PNG

    The Labels for this layer will then be added as a separate Layer (LABEL TYPE) which the user can choose to display or hide.

    MapThat___Creating_Label_Layers_-_4.PNG

    To create this Label Layer, in the MapThat Admin Forms, simply clone the existing Wards Layer and then change the LAYER TYPE = LABELS.

    MapThat___Creating_Label_Layers_-_5.PNG

    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.

    MapThat___Creating_Label_Layers_-_6.PNG

    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!

    MapThat___Creating_Label_Layers_-_7.PNG

    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

    MapThat___Creating_Label_Layers_-_8.PNG

    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!

    MapThat___Creating_Label_Layers_-_9.PNG

    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.

    MapThat___Creating_Label_Layers_-_10.PNG

    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

Please sign in to leave a comment.