Skip to content

feat: show only the most specific area name in DM notifications #114

Description

@hokiepokedad2

Description

Spun off from #109 — the "most specific area" DM feature request is an upstream PoracleNG concern, separate from the geofence toggle bug fixed in PR #113.

When a notification matches multiple overlapping areas/geofences, only show the most specific (smallest polygon area) name in the DM instead of listing all matching areas.

Current behavior

PoracleNG's {{areas}} DTS variable concatenates ALL matching geofence names where displayInMatches: true. Users with nested/overlapping geofences see redundant area names in every DM (e.g., "East City, North Region, Central Park").

Requested behavior

Sort matched areas by polygon area (m²) and return only the smallest match. Show "Central Park" instead of all three.

Investigation findings

This requires coordinated upstream changes:

PoracleWeb (this project)

  • Add area_m2 field to the geofence feed response (/api/geofence-feed) with calculated polygon area for each geofence
  • Straightforward — spherical excess or Shoelace formula on the polygon coordinates

PoracleNG (upstream)

  • Parse area_m2 from the geofence feed in the geofence loader
  • Add a new {{area}} (singular) DTS variable = smallest matched area by area_m2
  • Keep {{areas}} (plural) for backward compatibility
  • Possibly add a config flag like geofence.mostSpecificOnly: true

Architecture reference

PoracleWeb (geofence feed) → PoracleNG Go Processor (R-tree + PIP match)
    → PoracleNG Node.js Alerter (DTS template rendering) → Discord DM
  • PoracleNG Go processor: processor/internal/geofence/pip.go — point-in-polygon matching
  • PoracleNG alerter: src/controllers/*.js — builds areas DTS variable from matchedAreas.filter(displayInMatches)
  • PoracleWeb: GeofenceFeedController.cs — serves unified geofence feed (currently no area_m2 field)

Original user request

"Can the DM messages be set up to use just one name? Maybe easiest on your end to use the predefined, but I would like it be set to the 'most specific' geofence/predefined area. Could be done by sorting the geofences and predefined areas from smallest area (m²), then having the coords -> region check return as soon as it has a match rather than allowing for multiple matches."

— Nickel6558, Discord, March 26, 2026

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions