Customizing label positioning in N4V for Webi map components

Anonymised summary of support ticket #698747 (2024-11-19)

Symptom

When using a GeoJSON file with multiple polygons for a single zone (e.g., original zone + zoom zone), the default label position is centered between all polygons, leading to an incorrect display. The label may appear between the original zone and the zoom zone instead of being properly aligned with the intended area.

Environment

N4V FOR WEBI (Need4Viz extensions for SAP BusinessObjects Web Intelligence), SAP BusinessObjects Web Intelligence, GeoJSON files, N4V map components

Resolution

  1. Option 1: Modify the original zone codes in the GeoJSON to exclude them from mapping. The zone will then only consist of the zoom polygon, and the label will be correctly positioned on that polygon.
  2. Option 2: Keep both original and zoom polygons but adjust the label position by adding the properties 'hc-middle-x' and 'hc-middle-y' in the GeoJSON. These properties define the label position as a ratio (0 to 1) relative to the polygon's bounding box. Default is 0.5 (center). Adjust these values to move the label horizontally ('hc-middle-x') or vertically ('hc-middle-y') to the desired location.

Other resolution

Additional GeoJSON properties supported by N4V map components for customization: 'code' (mapping code), 'name' (default label), 'latitude' and 'longitude' (pie chart position in GPS coordinates), 'hc-middle-x' and 'hc-middle-y' (label position). Custom labels can also be added (e.g., 'nom_court' for short names, 'nom_minuscule' for lowercase or multi-line names using HTML <br> tags). These custom labels must be declared in the N4V engine configuration file (e.g., list_maps_codes.js) before use in the component.