Label Placement Collision Overlap Detector Two Labels

Pairwise axis-aligned rectangular label collision area; glyph contours, rotations and global placement omitted.

Description

Calculate the shared area of two axis-aligned label rectangles and flag positive-area collisions.

Two map labels can be screened for collision by approximating each as an axis-aligned rectangle. Positive shared area counts as a collision under this tool's convention; touching edges alone do not.

When to use this tool

Calculate the shared area of two axis-aligned label rectangles and flag positive-area collisions. Use it when the input measurements and conventions below match the operation you need.

  • Prepare labelABoundsMm, labelBBoundsMm, respecting the measurement basis and boundaries below.
  • Compare the worked example with your intended operation before reusing its result.

How to use the tool and how it works

  1. Enter every field in the input table using the stated units and exact supported selector spelling where applicable.
  2. Run the tool. Correct input errors before interpreting an output.
  3. Read the result fields below; use accompanying flags and the stated sign, boundary or model convention when interpreting a number.

Supply each bound list in the order [minimum x, minimum y, maximum x, maximum y], in millimeters. After checking ordered corners, the tool clips each intersection extent to zero, multiplies width by height, and sets positiveAreaCollision only when the product is greater than zero.1

Input fieldMeaning and unitsAccepted input
labelABoundsMmLabel a bounds mm. Millimeters.List of finite numbers
labelBBoundsMmLabel b bounds mm. Millimeters.List of finite numbers
Output fieldInterpretation
resultObject containing the following named result fields.
result.overlapAreaMm2Overlap area mm2; use the stated units and sign convention.
result.positiveAreaCollisionTrue only when the axis-aligned label rectangles share positive area.
json
{
  "input": {
    "labelABoundsMm": [
      0,
      0,
      3,
      2
    ],
    "labelBBoundsMm": [
      2,
      1,
      4,
      3
    ]
  },
  "output": {
    "result": {
      "overlapAreaMm2": 1,
      "positiveAreaCollision": true
    }
  }
}

Limitations and assumptions

  • The rectangles must already be measured in the same coordinate system. Rotated labels, curved glyph outlines, halos and required clearance are not modeled.
  • Every declared field is required and unexpected fields are rejected. Numeric inputs must be finite; input errors are distinct from a valid false result or an explicitly qualified output.
  • Extremely large inputs and nonfinite or excessively large outputs are rejected. List positions reported by the tool use zero-based indices unless stated otherwise.

Alternative or Complementary methods

For a map-layout decision, inspect the rendered map at its intended size as well as its numerical dimensions. For classification or coordinate work, retain the chosen boundary and coordinate conventions with the result. Compare the scope of the nearby tools below before substituting one.

References

  1. Tool behavior and example: Label Placement Collision Overlap Detector Two Labels — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies