Conversation
Add geotiff layer type handling in the MapLibre package using @geomatico/maplibre-cog-protocol. This registers a custom `cog://` protocol to load COG files as raster sources. Includes unit tests and an example component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55a09e4 to
3e8febf
Compare
jonathanlurie
left a comment
There was a problem hiding this comment.
Not sure the review was supposed to be on general design, and I don't want this feedback to be blocking as it's mostly about non-functional improvements
| type: 'xyz', | ||
| url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' | ||
| }, | ||
| { |
There was a problem hiding this comment.
The cog being addressed as geotiff (as defined in MapContextLayerGeotiff from packages/core/lib/model/map-context.ts) is misleading and could lead to think that any geotif would work, and not just cog. So unless all geotiff works, including non-cloud-optimized, then I would advice renaming the type cog and also all the internal terminology that refers to "geotiff".
There was a problem hiding this comment.
I was also surprised, @jahow why did you choose this keyword ?
There was a problem hiding this comment.
because it works with plain geotiffs in OL
There was a problem hiding this comment.
we can throw an error in MapLibre if it doesn't support non-COG geotiff
| ], | ||
| }; | ||
| } | ||
| case "geotiff": { |
There was a problem hiding this comment.
Instead of using the string "geotiff" in many occasion, it would be nice to have a variables instead. Also true for the other types, because a string is more prone to errors.
| ], | ||
| }; | ||
| } | ||
| case "geotiff": { |
There was a problem hiding this comment.
There are many cases here, the switch scope in its entirety is 150 lines already and is expected to contain even more in the future. To reduce reading complexity and improve maintainability (and onboarding of new devs), it would be nice each case enty calls a dedicated function (that are not exported and lay in the same file, at least for a start)
Summary
geotifflayer type support in the MapLibre package using@geomatico/maplibre-cog-protocolcog://protocol to load Cloud Optimized GeoTIFFs as raster tile sourcesTest plan
npx vitest runinpackages/maplibre)npm run devinapps/examples)Notes
Works well with the examples from the library, does not work with the COG in the OL examples though.
Opened an issue for that geomatico/maplibre-cog-protocol#36