Skip to content

Point-mode loadViewportSamples() doesn't wrap-split longitude predicate after antimeridian padding #220

@rdhyee

Description

@rdhyee

Scoped out of #219. Documented in EXPLORER_STATE.md §6 "Known pre-existing wrap bug NOT fixed in this PR."

Bug

loadViewportSamples() in the zoomWatcher OJS cell computes its 30% padding as bounds.east - bounds.west and emits a single longitude BETWEEN padded.west AND padded.east clause. For a viewport that wraps the antimeridian (e.g. west=170, east=-170), that math is meaningless and the SQL returns zero matches.

The bug pre-dates PR #219. PR #219 fixed the table by routing through viewerBboxSQL() which correctly handles the post-padding wrap case. But loadViewportSamples() still has its own padding/SQL emission, so at wrapping viewports the two surfaces diverge:

  • Table: shows correct row set (via viewerBboxSQL with split predicate)
  • Phase-msg "Samples in View": can undercount or read zero

Right fix

Share the viewerBboxSQL-style normalization with point-mode. The helper would need to return either an SQL string (current shape) or a structured {south, north, west, east, wraps} object so loadViewportSamples() can still use the bounds for its cache-hit check (isWithinCache(bounds)).

How to reproduce

Pan to a viewport that includes the international dateline (e.g. lat 0, lng 180, zoomed in enough to be in point mode). The globe should render some sample points; the phase-msg count may show 0 or far fewer than what's visible.

References

  • Helper that does it right: viewerBboxSQL() in explorer.qmd, post-padding longitude normalization
  • Buggy path: loadViewportSamples()padded.west / padded.eastWHERE longitude BETWEEN padded.west AND padded.east

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions