{{ message }}
Fix AnimationTool Stac urls#860
Merged
Merged
Conversation
Contributor
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.

With Claude
Fix AnimationTool CSP Violation with STAC Layers
Problem
When using the AnimationTool with STAC collection layers enabled, the browser threw a Content Security Policy (CSP) error:
Root Cause
The
stac-collection:URL scheme is a custom MMGIS notation that must be transformed into a proper HTTP URL before being passed to browser image loading functions. While this transformation existed for tile layers inmakeTileLayer(), it was missing fromL_.getUrl(), which is called bymakeImageLayer()and other layer functions. This issue was exposed by recent AnimationTool OffscreenMapManager changes (#856, #857).Solution
Transform
stac-collection:URLs into proper TiTiler PgSTAC HTTP endpoints before they reach the browser's image loading functions. This is accomplished by:transformStacUrl()function inLayers_.jsL_.getUrl()andmakeTileLayer()Changes
1. Added
transformStacUrl()FunctionFile:
src/essence/Basics/Layers_/Layers_.jsCreated a new exported function that:
stac-collection:URLs (case-insensitive)/titilerpgstac/collections/{collection}/tiles/{tileMatrixSet}/{z}/{x}/{y}?assets=asset.../titilerpgstac/collections/{collection}/preview?assets=asset...cogBands,cogExpression,cogResampling,tileMatrixSet2. Updated
L_.getUrl()MethodFile:
src/essence/Basics/Layers_/Layers_.jsModified to use the new
transformStacUrl()function for STAC URLs. This automatically fixes:makeImageLayer()- which callsL_.getUrl()L_.getUrl()for URL resolution3. Refactored
makeTileLayer()File:
src/essence/Basics/Map_/Map_.jsUpdated to import and use the shared
transformStacUrl()function instead of inline transformation logic. This:4. Added Comprehensive Tests
File:
tests/unit/stac-url-transformation.spec.js(NEW)Created 19 unit tests covering:
Example Transformation
Input:
Output (tiles):
Output (images):
Testing
Unit Tests
Build
Manual Testing Recommended
To verify the fix works end-to-end:
WITH_STAC=truein.envand configure a STAC collection layer/titilerpgstac/collections/{name}/...stac-collection:URLs are being fetchedImpact
Related Issues
Breaking Changes
None. This is a bug fix that maintains backward compatibility.