Fix #220: antimeridian wrap in point-mode loadViewportSamples()#310
Open
rdhyee wants to merge 1 commit into
Open
Fix #220: antimeridian wrap in point-mode loadViewportSamples()#310rdhyee wants to merge 1 commit into
rdhyee wants to merge 1 commit into
Conversation
…les() loadViewportSamples() computed its own 30% padding from raw bounds and emitted a single `longitude BETWEEN padded.west AND padded.east`. At a viewport that wraps the dateline, west > east (and `bounds.east - bounds.west` is negative, so the inline lngPad was meaningless), so `BETWEEN a-larger AND a-smaller` matched ZERO rows — point mode and the "Samples in View" count (computed off the same WHERE) read 0 / undercounted near the antimeridian while the table (routed through viewerBboxSQL since isamplesorg#219) showed the correct set. Route loadViewportSamples() through the SAME viewerBboxSQL('latitude', 'longitude', VIEWPORT_PAD_FACTOR) helper the table uses. It emits the split `(lng BETWEEN west AND 180 OR lng BETWEEN -180 AND east)` for the wrap case and normalizes post-padding overflow back into [-180,180]. Point mode, the in-view count, and the table now share one wrap-aware bbox. renderSamplePoints' unused `bounds` arg is left untouched (out of scope). Native proof (real lite data, west=170/east=-170 dateline viewport): old predicate → 0 rows; wrap-split → 31,441. Fixes isamplesorg#220.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #220 — antimeridian wrap in point-mode
loadViewportSamples()Closes #220 (the pre-existing wrap bug explicitly scoped out of #219).
Bug
loadViewportSamples()computed its own 30% padding from rawgetViewportBounds()and emitted a singlelongitude BETWEEN padded.west AND padded.east. At a viewport that wraps the antimeridian (e.g.west=170, east=-170),west > east, soBETWEEN a-larger AND a-smallermatches zero rows (andbounds.east - bounds.westis negative, so the inlinelngPadwas meaningless too). The table was already correct there (routed throughviewerBboxSQLsince #219); only point mode + its "Samples in View" count (computed off the same WHERE) read 0 / undercounted near the dateline — so the two surfaces diverged.Fix
Route
loadViewportSamples()through the sameviewerBboxSQL('latitude', 'longitude', VIEWPORT_PAD_FACTOR)helper the table uses. It emits the split(lng BETWEEN west AND 180 OR lng BETWEEN -180 AND east)for the wrap case and normalizes post-padding overflow back into[-180,180]. Point mode, the in-view count, and the table now share one wrap-aware bbox. The vestigialboundsarg torenderSamplePointsis left untouched (out of scope).Verification
longitude BETWEEN 170 AND -170→ 0 rows; wrap-split → 31,441.COUNT(*)query reuse the fixedwhereClause.WHERE 1=1${bboxSQL}is valid (filter helpers return''orAND …), non-wrapping behavior is identical, and the only remaining raw longitude ranges are the out-of-scopemeta.lng ± deltapoint-selection queries.EXPLORER_STATE.md §6updated (was "known bug NOT fixed" → "FIXED in Point-mode loadViewportSamples() doesn't wrap-split longitude predicate after antimeridian padding #220").Scope
Single-file, low-risk:
loadViewportSamples()+ two doc updates. Independent of the #305 facet-count stack.