Skip to content

Commit

Permalink
Merge pull request #280 from KaiVolland/image-format
Browse files Browse the repository at this point in the history
Introduces "format" property for the IconSymbolizer
  • Loading branch information
KaiVolland authored Sep 28, 2021
2 parents c5e0ad6 + 1341002 commit 2f9b0ad
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 4 deletions.
7 changes: 5 additions & 2 deletions examples/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const sampleStyle: Style = {
visibility: false,
allowOverlap: true,
optional: false,
rotationAlignment: 'map'
rotationAlignment: 'map',
image: 'http://myserver/getImage',
format: 'image/png'
}, {
kind: 'Line',
blur: 3,
Expand Down Expand Up @@ -95,7 +97,8 @@ const sampleStyle: Style = {
kind: 'Fill',
color: '#FF0000',
graphicFill: {
kind: 'Icon'
kind: 'Icon',
image: '/myimage.png'
}
}, {
kind: 'Raster',
Expand Down
109 changes: 107 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,53 @@
"type": "array"
},
{
"description": "A ComparisonFilter compares a value of an object (by key) with an expected\nvalue.",
"description": "A Filter that checks if a property is in a range of two values (inclusive).",
"items": [
{
"enum": [
"<=x<="
],
"type": "string"
},
{
"anyOf": [
{
"description": "A FunctionFilter that expects a string (propertyName) as second argument and\na regular expression as third argument. An actual parser implementation has to\nreturn a value for this function expression.",
"items": [
{
"enum": [
"FN_strMatches"
],
"type": "string"
},
{
"type": "string"
},
{
"$ref": "http://geostyler/geostyler-style.json#/definitions/RegExp"
}
],
"maxItems": 3,
"minItems": 3,
"type": "array"
},
{
"type": "string"
}
]
},
{
"type": "number"
},
{
"type": "number"
}
],
"maxItems": 4,
"minItems": 4,
"type": "array"
},
{
"items": [
{
"description": "The possible Operators used for comparison Filters.",
Expand All @@ -200,6 +246,7 @@
"*=",
"<",
"<=",
"<=x<=",
"==",
">",
">="
Expand Down Expand Up @@ -308,6 +355,17 @@
"description": "A color defined as a hex-color string.",
"type": "string"
},
"format": {
"description": "An optional configuration for the image format as MIME type.\nThis might be needed if the image(path) has no filending specified. e.g. http://myserver/getImage",
"enum": [
"image/gif",
"image/jpeg",
"image/jpg",
"image/png",
"image/svg+xml"
],
"type": "string"
},
"haloBlur": {
"description": "The halo's fadeout distance towards the outside.",
"type": "number"
Expand Down Expand Up @@ -881,7 +939,53 @@
"type": "array"
},
{
"description": "A ComparisonFilter compares a value of an object (by key) with an expected\nvalue.",
"description": "A Filter that checks if a property is in a range of two values (inclusive).",
"items": [
{
"enum": [
"<=x<="
],
"type": "string"
},
{
"anyOf": [
{
"description": "A FunctionFilter that expects a string (propertyName) as second argument and\na regular expression as third argument. An actual parser implementation has to\nreturn a value for this function expression.",
"items": [
{
"enum": [
"FN_strMatches"
],
"type": "string"
},
{
"type": "string"
},
{
"$ref": "http://geostyler/geostyler-style.json#/definitions/RegExp"
}
],
"maxItems": 3,
"minItems": 3,
"type": "array"
},
{
"type": "string"
}
]
},
{
"type": "number"
},
{
"type": "number"
}
],
"maxItems": 4,
"minItems": 4,
"type": "array"
},
{
"items": [
{
"description": "The possible Operators used for comparison Filters.",
Expand All @@ -890,6 +994,7 @@
"*=",
"<",
"<=",
"<=x<=",
"==",
">",
">="
Expand Down
5 changes: 5 additions & 0 deletions style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ export interface IconSymbolizer extends BasePointSymbolizer {
* A path/URL to the icon image file.
*/
image?: string;
/**
* 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
*/
format?: `image/${'png' | 'jpg' | 'jpeg' | 'gif' | 'svg+xml'}`;
/**
* If true, the icon will be kept upright.
*/
Expand Down

0 comments on commit 2f9b0ad

Please sign in to comment.