Skip to content
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

Add support for image sprites #583

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,28 @@ export interface TextSymbolizer extends BasePointSymbolizer {
fontWeight?: Expression<'normal' | 'bold'>;
}

/**
* Configuration for a sprite image.
*/
export type Sprite = {
/**
* A path/URL to the sprite image file.
*/
source: Expression<string>;
/**
* The starting position of the sprite to cut out. Origing [0, 0] is top left.
*/
position: [Expression<number>, Expression<number>];
KaiVolland marked this conversation as resolved.
Show resolved Hide resolved
/**
* The width of the sprite.
*/
width: Expression<number>;
/**
* The height of the sprite.
*/
height: Expression<number>;
};

/**
* An IconSymbolizer describes the style representation of POINT data if styled
* with a specific icon.
Expand Down Expand Up @@ -421,9 +443,9 @@ export interface IconSymbolizer extends BasePointSymbolizer {
*/
haloOpacity?: Expression<number>;
/**
* A path/URL to the icon image file.
* A path/URL to the icon image file or a {@link Sprite} configuration.
*/
image?: Expression<string>;
image?: Expression<string> | Sprite;
/**
* An optional configuration for the image format as MIME type.
* This might be needed if the image(path) has no filending specified. e.g. http://myserver/getImage
Expand Down
Loading