Skip to content

GET /addresses/:id returns no geo coordinates — GNAF data uses 'geocoding' field, not 'geo' #1

@sweets9

Description

@sweets9

Bug

When calling GET /addresses/:id the response has no geo data even though ADDRESSKIT_ENABLE_GEO=1 is set and the GNAF data is loaded correctly.

Root cause

In dist/cli.js, the address detail handler builds the response attributes from the OpenSearch document. It looks for the geocoding data under struct.geo and innerStruct.geo, but the GNAF document actually stores it under structured.geocoding.

Buggy code (~line 40620 in dist/cli.js):

...(innerStruct.geo ?? struct.geo) !== void 0 && {
  geo: innerStruct.geo ?? struct.geo

GNAF document shape (confirmed via OpenSearch inspection):

{
  "structured": {
    "geocoding": { "latitude": -34.928, "longitude": 138.600 },
    ...
  }
}

Fix

...(innerStruct.geocoding ?? struct.geocoding ?? innerStruct.geo ?? struct.geo) !== void 0 && {
  geo: innerStruct.geocoding ?? struct.geocoding ?? innerStruct.geo ?? struct.geo

This checks geocoding first (the actual GNAF field name) then falls back to geo for forward compatibility.

Steps to reproduce

  1. Run AddressKit with ADDRESSKIT_ENABLE_GEO=1 and a loaded GNAF dataset (Jan 2026)
  2. Call GET /addresses/<any-gnaf-pid>
  3. attributes.geo is absent from the response even though lat/lon exists in OpenSearch

Environment

  • AddressKit v3.0.1
  • GNAF Jan 2026
  • OpenSearch 2.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions