-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
307 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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,17 @@ | ||
LAYER | ||
NAME "raster_simple_raster" | ||
TYPE RASTER | ||
PROCESSING "RESAMPLE=AVERAGE" | ||
DATA "../rasters/raster.tif" | ||
EXTENT -180 -90 180 90 | ||
METADATA | ||
"wms_title" "raster_simple_raster" | ||
"wms_srs" "EPSG:4326" | ||
END | ||
CLASS | ||
NAME "Test raster" | ||
STYLE | ||
OPACITY 100 | ||
END | ||
END | ||
END |
This file contains 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,17 @@ | ||
LAYER | ||
NAME "raster_simple_raster" | ||
TYPE RASTER | ||
PROCESSING "RESAMPLE=NEAREST" | ||
DATA "../rasters/raster.tif" | ||
EXTENT -180 -90 180 90 | ||
METADATA | ||
"wms_title" "raster_simple_raster" | ||
"wms_srs" "EPSG:4326" | ||
END | ||
CLASS | ||
NAME "Test raster" | ||
STYLE | ||
OPACITY 100 | ||
END | ||
END | ||
END |
23 changes: 23 additions & 0 deletions
23
data/mapfiles/raster_simple_raster_many_classes_filter_intervals.map
This file contains 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,23 @@ | ||
LAYER | ||
NAME "Simple raster" | ||
TYPE RASTER | ||
DATA "../rasters/raster.tif" | ||
STATUS DEFAULT | ||
CLASSITEM "[pixel]" | ||
CLASS | ||
NAME "0- 100" | ||
EXPRESSION ( ( [pixel] > 0 ) AND ( [pixel] <= 100 ) ) | ||
STYLE | ||
COLOR 0 255 0 | ||
OPACITY 100 | ||
END | ||
END | ||
CLASS | ||
NAME "100 - 200" | ||
EXPRESSION ( ( [pixel] > 100 ) AND ( [pixel] <= 200 ) ) | ||
STYLE | ||
COLOR 0 0 255 | ||
OPACITY 100 | ||
END | ||
END | ||
END |
25 changes: 25 additions & 0 deletions
25
data/mapfiles/raster_simple_raster_many_classes_filter_ramp.map
This file contains 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,25 @@ | ||
LAYER | ||
NAME "Simple raster" | ||
TYPE RASTER | ||
DATA "../rasters/raster.tif" | ||
STATUS DEFAULT | ||
CLASSITEM "[pixel]" | ||
CLASS | ||
NAME "0- 100" | ||
EXPRESSION ( ( [pixel] > 0 ) AND ( [pixel] <= 100 ) ) | ||
STYLE | ||
COLORRANGE 0 0 0 0 50 0 | ||
DATARANGE 0 100 | ||
RANGEITEM "pixel" | ||
END | ||
END | ||
CLASS | ||
NAME "100 - 200" | ||
EXPRESSION ( ( [pixel] > 100 ) AND ( [pixel] <= 200 ) ) | ||
STYLE | ||
COLORRANGE 0 50 0 0 50 80 | ||
DATARANGE 101 200 | ||
RANGEITEM "pixel" | ||
END | ||
END | ||
END |
23 changes: 23 additions & 0 deletions
23
data/mapfiles/raster_simple_raster_many_classes_filter_values.map
This file contains 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,23 @@ | ||
LAYER | ||
NAME "Simple raster" | ||
TYPE RASTER | ||
DATA "../rasters/raster.tif" | ||
STATUS DEFAULT | ||
CLASSITEM "[pixel]" | ||
CLASS | ||
NAME "0" | ||
EXPRESSION "0" | ||
STYLE | ||
COLOR 0 255 0 | ||
OPACITY 100 | ||
END | ||
END | ||
CLASS | ||
NAME "1" | ||
EXPRESSION "1" | ||
STYLE | ||
COLOR 0 0 255 | ||
OPACITY 100 | ||
END | ||
END | ||
END |
This file contains 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,15 @@ | ||
import { Style } from 'geostyler-style'; | ||
|
||
const rasterStyle: Style = { | ||
'name': 'raster_simple_raster', | ||
'rules': [{ | ||
'name': 'Test raster', | ||
'symbolizers': [{ | ||
'kind': 'Raster', | ||
'opacity': 1.0, | ||
'resampling': 'linear' | ||
}] | ||
}] | ||
}; | ||
|
||
export default rasterStyle; |
This file contains 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,15 @@ | ||
import { Style } from 'geostyler-style'; | ||
|
||
const rasterStyle: Style = { | ||
'name': 'raster_simple_raster', | ||
'rules': [{ | ||
'name': 'Test raster', | ||
'symbolizers': [{ | ||
'kind': 'Raster', | ||
'opacity': 1.0, | ||
'resampling': 'nearest' | ||
}] | ||
}] | ||
}; | ||
|
||
export default rasterStyle; |
25 changes: 25 additions & 0 deletions
25
data/styles/raster_simple_raster_many_classes_filter_intervals.ts
This file contains 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,25 @@ | ||
import { Style } from 'geostyler-style'; | ||
|
||
const rasterStyle: Style = { | ||
name: 'raster_simple_raster_many_classes_filter_intervals', | ||
rules: [{ | ||
name: 'Test raster', | ||
symbolizers: [{ | ||
kind: 'Raster', | ||
colorMap: { | ||
type: 'intervals', | ||
colorMapEntries: [{ | ||
color: '#00FF00', | ||
quantity: 100, | ||
opacity: 1 | ||
}, { | ||
color: '#0000FF', | ||
quantity: 200, | ||
opacity: 1 | ||
}] | ||
}, | ||
}] | ||
}] | ||
}; | ||
|
||
export default rasterStyle; |
27 changes: 27 additions & 0 deletions
27
data/styles/raster_simple_raster_many_classes_filter_ramp.ts
This file contains 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,27 @@ | ||
import { Style } from 'geostyler-style'; | ||
|
||
const rasterStyle: Style = { | ||
name: 'raster_simple_raster_many_classes_filter_ramp', | ||
rules: [{ | ||
name: 'Test raster', | ||
symbolizers: [{ | ||
kind: 'Raster', | ||
colorMap: { | ||
type: 'ramp', | ||
colorMapEntries: [{ | ||
color: '#000000', | ||
quantity: 0 | ||
}, { | ||
color: '#003200', | ||
quantity: 100, | ||
opacity: 1 | ||
}, { | ||
color: '#003250', | ||
quantity: 200 | ||
}] | ||
}, | ||
}] | ||
}] | ||
}; | ||
|
||
export default rasterStyle; |
25 changes: 25 additions & 0 deletions
25
data/styles/raster_simple_raster_many_classes_filter_values.ts
This file contains 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,25 @@ | ||
import { Style } from 'geostyler-style'; | ||
|
||
const rasterStyle: Style = { | ||
name: 'raster_simple_raster_many_classes_filter_values', | ||
rules: [{ | ||
name: 'Test raster', | ||
symbolizers: [{ | ||
kind: 'Raster', | ||
colorMap: { | ||
type: 'values', | ||
colorMapEntries: [{ | ||
color: '#00FF00', | ||
quantity: 0, | ||
opacity: 1 | ||
}, { | ||
color: '#0000FF', | ||
quantity: 1, | ||
opacity: 1 | ||
}] | ||
}, | ||
}] | ||
}] | ||
}; | ||
|
||
export default rasterStyle; |
This file contains 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 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 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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
/** | ||
* Convert a color in RGB (R G B) format to hexadecimal (#RRGGBB) format | ||
* | ||
* @param {string} s The string representing the color in RGB in the Mapfile file | ||
* @return {string} The same color in hexadecimal format | ||
*/ | ||
* Convert a color in RGB (R G B) format to hexadecimal (#RRGGBB) format | ||
* | ||
* @param {string} s The string representing the color in RGB in the Mapfile file | ||
* @return {string} The same color in hexadecimal format | ||
*/ | ||
export function rgbToHex(s: string): string { | ||
const rgb = s.split(' ').map(Number); | ||
// eslint-disable-next-line no-bitwise | ||
return '#' + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).toUpperCase().slice(1); | ||
} | ||
|
||
/** | ||
* Convert a color range in RGB (R G B R G B) format to hexadecimal (#RRGGBB) array | ||
* | ||
* @param {string} s The strings representing the range of colors in RGB in the Mapfile file | ||
* @return {string[]} The same colors as an array of strings in hexadecimal format | ||
*/ | ||
export default function rgbRangeToHexArray(s: string): string[] { | ||
const lowerBoundColor = rgbToHex(s.split(' ').slice(1, 3).join(' ')); | ||
const upperBoundColor = rgbToHex(s.split(' ').slice(4, 6).join(' ')); | ||
return [lowerBoundColor, upperBoundColor]; | ||
} |