Repository navigation
addCOG(): stream the COG again; use colorOptions - #110
Open
eliotmcintire wants to merge 1 commit into
Open
eliotmcintire wants to merge 1 commit into
eliotmcintire wants to merge 1 commit into
Conversation
addCOG() downloaded the whole file (fetch + arrayBuffer) since mouse events were added in 2b75a37, because geoblaze.identify() needs the values in memory. Now the url is passed to parseGeoraster(), so only the tiles and overview level needed for the view are read, and the value under the mouse is read as a single pixel (cogMouseHandler). colorOptions is applied; with no domain, it is taken from the smallest overview. georaster-keep.js keeps georaster.min.js's parseGeoraster: geoblaze.js, loaded after it, replaces the global with an older georaster that fails on overview reads ("No image at index n"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXeXwtafUJiXgqLqcTv
Member
|
Sounds good! |
eliotmcintire
marked this pull request as ready for review
November 19, 2026 04:41
This branch has not been deployed
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.
Thanks for leafem; I am a heavy user of it, through the map viewer in our SpaDES.shiny package. I only work in R, so I used Claude (an AI assistant) to find the cause and write the fix. This is a person and an AI working on it together.
Closes #109.
addCOG()once again reads only the tiles and overview needed for the view, not the whole file. The mouse readout still works: it now reads just the pixel under the cursor.colorOptionsis now applied.Technical details
georaster-binding.js:addCOGcallsparseGeorasterCOG(url)instead offetch(url)+arrayBuffer().cogColorFn(): same palette/breaks/na.color handling asaddGeotiff(). A streamed georaster has no mins/maxs, so whendomainisNULLit is read from a 256×256 overview. An explicitpixelValuesToColorFnstill wins.cogMouseHandler(): likemouseHandler(), but does a 1×1getValues()at the cursor and fires the same control text and Shiny events. Cursor → pixel supports EPSG:4326 and EPSG:3857, which proj4 knows without a definition; for other CRSs the layer draws but has no readout.georaster-keep.js, loaded betweengeoraster.min.jsandgeoblaze.js:var parseGeorasterCOG = parseGeoraster;. geoblaze.js replaces the globalparseGeorasterwith its bundled older georaster, which throws "No image at index n" when reading overviews.addGeotiff()and other callers are unchanged."image", as inaddGeotiff(), soremoveImage()/clearImages()work on it.colorOptionsandpixelValuesToColorFnupdated; NEWS entry.Tested in headless Chromium:
gdallocationinfoat the same point.addCOG()example (Sentinel-2 RGB preview, UTM) renders the same as before.addGeotiff()is unchanged.No tests added: the package has no JS tests, and this needs a browser plus a range-request server. Happy to add something if you have a pattern you prefer.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Lx3DXeXwtafUJiXgqLqcTv