-
Notifications
You must be signed in to change notification settings - Fork 3
Add expression_type and stylesheet link support to rendering extension
#28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
c385c42
Add expression_type and stylesheet link support to rendering extension
emmanuelmathot 3819e57
Merge remote-tracking branch 'origin/main' into fix/issue-17-21-forma…
emmanuelmathot 18e56b4
fix(schema): enforce expression requirement when expression_type is s…
emmanuelmathot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "type": "Feature", | ||
| "stac_version": "1.0.0", | ||
| "stac_extensions": [ | ||
| "https://stac-extensions.github.io/render/v2.1.0/schema.json" | ||
| ], | ||
| "id": "roads-example", | ||
| "bbox": [ | ||
| 2.25, | ||
| 48.82, | ||
| 2.42, | ||
| 48.9 | ||
| ], | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [ | ||
| 2.25, | ||
| 48.82 | ||
| ], | ||
| [ | ||
| 2.25, | ||
| 48.9 | ||
| ], | ||
| [ | ||
| 2.42, | ||
| 48.9 | ||
| ], | ||
| [ | ||
| 2.42, | ||
| 48.82 | ||
| ], | ||
| [ | ||
| 2.25, | ||
| 48.82 | ||
| ] | ||
| ] | ||
| ] | ||
| }, | ||
| "properties": { | ||
| "datetime": "2024-01-01T00:00:00Z", | ||
| "renders": { | ||
| "roads-by-class": { | ||
| "title": "Roads colored by class", | ||
| "assets": [ | ||
| "roads" | ||
| ], | ||
| "expression": [ | ||
| "match", | ||
| [ | ||
| "get", | ||
| "class" | ||
| ], | ||
| "motorway", | ||
| "#e15c5c", | ||
| "primary", | ||
| "#f2b46d", | ||
| "#cccccc" | ||
| ], | ||
| "expression_type": "application/vnd.maplibre.expression+json" | ||
| } | ||
| } | ||
| }, | ||
| "links": [ | ||
| { | ||
| "rel": "stylesheet", | ||
| "type": "application/vnd.mapbox.style+json", | ||
| "href": "https://example.com/styles/roads.json", | ||
| "title": "Roads MapLibre style", | ||
| "render": "roads-by-class" | ||
| } | ||
| ], | ||
| "assets": { | ||
| "roads": { | ||
| "title": "Road network", | ||
| "type": "application/geo+json", | ||
| "roles": [ | ||
| "data" | ||
| ], | ||
| "href": "https://example.com/data/roads.geojson" | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,16 @@ | |
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "properties": { | ||
| "links": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/stylesheet_link" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
|
|
@@ -128,6 +138,22 @@ | |
| } | ||
| ], | ||
| "definitions": { | ||
| "stylesheet_link": { | ||
| "$comment": "If a link's rel is 'stylesheet', it MUST carry a media type identifying the stylesheet format.", | ||
| "if": { | ||
| "type": "object", | ||
| "required": ["rel"], | ||
| "properties": { | ||
| "rel": { | ||
| "const": "stylesheet" | ||
| } | ||
| } | ||
| }, | ||
| "then": { | ||
| "type": "object", | ||
| "required": ["type"] | ||
| } | ||
| }, | ||
| "stac_extensions": { | ||
| "type": "object", | ||
| "required": [ | ||
|
|
@@ -225,6 +251,12 @@ | |
| "required": [ | ||
| "assets" | ||
| ], | ||
| "if": { | ||
| "required": ["expression_type"] | ||
| }, | ||
| "then": { | ||
| "required": ["expression"] | ||
| }, | ||
| "properties": { | ||
| "assets": { | ||
| "type": "array", | ||
|
|
@@ -265,6 +297,9 @@ | |
| "expression": { | ||
| "type": ["string", "object", "array"] | ||
| }, | ||
| "expression_type": { | ||
| "type": "string" | ||
| }, | ||
|
Comment on lines
297
to
+302
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the schema should ensure that expression_type is required when expression is set and vice versa. They can't really be provided alone. |
||
| "minmax_zoom": { | ||
| "type": "array", | ||
| "items": { | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also make this usable without the render extension? So that we can just connect an asset and a style? Especially in the vector case it doesn't make a lot of sense to use render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually make sense when you want to fine tune the rendering. Check the examples.
Besides that note, I do not see what prevent a user to add a stylesheet link as of today.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a misunderstanding.
The way it is is fine for render, but there's no way to directly make a connection between asset (or another link) and the stylesheet. For vector you may just want t a stylesheet without the render extension, as render is primarily targeting raster data.