Skip to content

Correct the bbox coordinate order and document the time parameters - #40

Merged
dirkwa merged 1 commit into
mainfrom
docs-bbox-order
Aug 8, 2026
Merged

Correct the bbox coordinate order and document the time parameters#40
dirkwa merged 1 commit into
mainfrom
docs-bbox-order

Conversation

@dirkwa

@dirkwa dirkwa commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

bbox is parsed latitude-first, but every piece of documentation said longitude-first.

Source Says Reality
README lon1, lat1, lon2, lat2
Code comment in validateParameters lon1,lat1,lon2,lat2
OpenAPI description in #10 west,south,east,north
The code sw: [swLat, swLng], ne: [neLat, neLng] lat-first

The failure mode is the bad kind: quiet. The README's own example, ?bbox=130,-35,139,-33, parses as a box starting at latitude 130 — impossible, so it matches nothing and returns {} with a 200. No error, no clue.

#10's OpenAPI example gives the confusion away: 51.28,-0.489,… is London as lat, lon, sitting directly under text that says west,south,east,north.

Docs changed, code unchanged

Anyone with a working bbox query today is using lat-first — that is what the code does. Flipping the parser to match the docs would break them exactly as silently as the docs break newcomers. So the documentation moves.

Whether lat-first is the right choice at all is a spec question for signalk-server#2504 — the v2 API can settle it deliberately. Note the parameter is the odd one out: this endpoint's own GeoJSON output is [lng, lat].

The antimeridian case is now documented too (lon1 greater than lon2, e.g. bbox=-10,175,10,-175), which the code has always supported via the +360 in createInBounds but nothing mentioned.

Also: the time parameters had no documentation

/self/track and from/to/duration/resolution shipped in #37 with nothing user-facing. Added, including the half-open window semantics that let clients concatenate consecutive bands safely, and a note that timespan/timespanOffset are Freeboard-SK compatibility rather than spec.

Every example is now executed

src/readme.test.ts runs each README example as a test, the antimeridian box included. A wrong example now fails the build instead of quietly misleading someone — which is the actual mechanism that prevents this recurring.

79 tests pass; typecheck, lint, format and build clean.

bbox is parsed latitude-first, but README, the code comment and the OpenAPI
description in #10 all said lon1,lat1,lon2,lat2. Following the docs produced
a box with a latitude of 130, which cannot exist — so the query was accepted
and silently matched nothing rather than failing. The README example was
Australia written in the order that does not work.

Correct the documentation to match the code rather than the reverse: the
current behaviour is what any working caller already relies on, and changing
the parsing would break them silently, in the same way the wrong docs do
now. Whether lat-first is the right choice for the v2 API is a question for
SignalK/signalk-server#2504, not something to settle unilaterally here.

Also document /self/track and the from/to/duration/resolution parameters
added in #37, which had no user-facing documentation at all.

Every example in the README is now executed by readme.test.ts, including the
antimeridian case, so a wrong example fails the build instead of silently
misleading people.
@dirkwa
dirkwa merged commit c8cfc56 into main Aug 8, 2026
24 checks passed
@dirkwa
dirkwa deleted the docs-bbox-order branch August 8, 2026 19:44
@dirkwa dirkwa added the documentation Improvements or additions to documentation label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant