Skip to content

cog_range_viewer: range a bundled COG hosted via _asset (drop the daemon) - #2

Open
isaacbrodsky wants to merge 3 commits into
mainfrom
claude/http-range-asset-route-dpj3r0
Open

cog_range_viewer: range a bundled COG hosted via _asset (drop the daemon)#2
isaacbrodsky wants to merge 3 commits into
mainfrom
claude/http-range-asset-route-dpj3r0

Conversation

@isaacbrodsky

@isaacbrodsky isaacbrodsky commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The COG range viewer used a 127.0.0.1 range daemon (range_server.py) to stream a local file into geotiff.js — impossible on a hosted page, which is why the daemon-dependent path couldn't be served. With HTTP Range now on the hosted _asset route (fusedio/fused #336) and on /api/fs/raw locally, a Range-capable URL comes from fused.rawUrl() in both environments, so the daemon is unnecessary everywhere.

What changed

  • Bundle a real tiled COG (sample_cog.tif) so a hosted page has a file to stream.
  • Resolve COG_URL via fused.rawUrl(): hosted → the Range-capable _asset route; local → /api/fs/raw (also Range-capable). An explicit ?url= still ranges a remote COG, and the no-params local default stays the 316 MB public Sentinel-2 demo. On a hosted page the bundled COG is the default, streamed with no daemon.
  • Remove range_server.py and drop the boot() daemon path.
  • Because _asset / /api/fs/raw are same-origin with the page, the cross-origin CORS dance the daemon needed goes away.
  • README documents the daemon-free range sources and the URL params.

Depends on fusedio/fused #336 for the hosted case; the local case works today.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn


Generated by Claude Code


Note

Medium Risk
Behavior depends on Range-capable _asset and /api/fs/raw (hosted case tied to fused #336); incorrect hosted detection or non-literal rawUrl would break the default COG on deploy.

Overview
Removes the localhost range_server.py path so geotiff.js always reads a normal HTTP URL with Range support—no 127.0.0.1 daemon or fused.runPython bootstrap in boot().

Adds hosted/local COG resolution at load time: ?url= for any remote COG; on hosted pages, fused.rawUrl("./sample_cog.tif") for a bundled sample_cog.tif served from the _asset route; locally, ?file= via /api/fs/raw or the existing public Sentinel-2 default. Hosted detection uses window.__FUSED_RENDER__ (and fused.env === "hosted" when available), matching hexagon_lab. UI copy distinguishes disk vs bundled vs remote sources.

Docs describe daemon-free byte sources, deploy, and URL params; range_server.py is dropped from the file list in favor of sample_cog.tif.

Reviewed by Cursor Bugbot for commit 8cace66. Bugbot is set up for automated code reviews on this repo. Configure here.

…mon)

The viewer used a 127.0.0.1 range daemon (range_server.py) to stream a local
file into geotiff.js — impossible on a hosted page. With HTTP Range now on the
hosted _asset route (and /api/fs/raw locally), a Range-capable URL comes from
fused.rawUrl() in both environments, so the daemon is unnecessary everywhere.

- Bundle a real tiled COG (sample_cog.tif) so a hosted page has one to stream.
- Resolve COG_URL via fused.rawUrl(): hosted -> _asset (Range), local -> /api/fs/raw
  (Range); an explicit ?url= still ranges a remote COG, and the no-params local
  default stays the 316 MB public Sentinel-2 demo. On a hosted page the bundled
  COG is the default, streamed with no daemon.
- Remove range_server.py and drop the boot() daemon path.
- README: document the daemon-free range sources and URL params.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
Comment thread geospatial/cog_range_viewer/index.html Outdated
Comment thread geospatial/cog_range_viewer/index.html Outdated
Two fixes to the hosted bundled-COG path:

- Use a string-literal fused.rawUrl("./sample_cog.tif"): the deploy exporter
  scans literal rawUrl paths to bundle the file and the hosted runtime maps that
  literal to the _asset route. The previous fused.rawUrl("./" + BUNDLED_COG)
  concatenation is a computed path -> the COG would be left unbundled/unmapped
  and range fetches would 404 hosted. The local ?file= path is genuinely dynamic,
  so it hits /api/fs/raw directly rather than through rawUrl (no export warning).

- Detect hosted via window.__FUSED_RENDER__ as well as fused.env === "hosted":
  the serve runtime does not (yet) expose fused.env, so the env check alone
  silently fails on open.fused.io and the page falls back to the remote default
  instead of the bundled COG. Every hosted artifact is seeded with
  window.__FUSED_RENDER__ before any script runs (matches hexagon_lab).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7086413. Configure here.

Comment thread geospatial/cog_range_viewer/index.html
On a hosted page resolveCogUrl ignores ?file= (no local FS) and streams the
bundled COG, but FILE_NAME and the lede still treated LOCAL_FILE as
authoritative — so a hosted ?file= page could name a disk path and say "on your
disk" while actually ranging sample_cog.tif. Gate the UI on LOCAL_ACTIVE
(LOCAL_FILE && !HOSTED) so it reflects the file that is really served.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants