From f82e4dca43ec054373b8d7786117cdb5c166477e Mon Sep 17 00:00:00 2001 From: Kai Volland Date: Thu, 19 Oct 2023 17:08:09 +0200 Subject: [PATCH] feat: add support for image sprites BREAKING CHANGE: IconSymbolizer.image can be a Sprite --- style.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/style.ts b/style.ts index af8179abc..ef44379d7 100644 --- a/style.ts +++ b/style.ts @@ -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; + /** + * The starting position of the sprite to cut out. Origing [0, 0] is top left. + */ + position: [Expression, Expression]; + /** + * The width of the sprite. + */ + width: Expression; + /** + * The height of the sprite. + */ + height: Expression; +}; + /** * An IconSymbolizer describes the style representation of POINT data if styled * with a specific icon. @@ -423,7 +445,7 @@ export interface IconSymbolizer extends BasePointSymbolizer { /** * A path/URL to the icon image file. */ - image?: Expression; + image?: Expression | 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