Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
72f0877
Add Image layer type
ac-61 Sep 4, 2024
0d2caef
Add image layer
ac-61 Sep 4, 2024
7f92e83
Add georaster-layer-for-leaflet package
ac-61 Sep 5, 2024
2b48b3f
Try different package
ac-61 Sep 5, 2024
ba1a8c7
Add opacity setting for geotiff image layer
ac-61 Sep 18, 2024
4063aa1
Try georaster-layer-for-leaflet v4.1.1-0
ac-61 Sep 26, 2024
34c4067
Use correct georaster library version
ac-61 Oct 3, 2024
63e6aad
Do not fetch entire COG file before loading
ac-61 Oct 3, 2024
7f42734
Fix COG layer ordering
ac-61 Oct 3, 2024
05071ac
Add variable to hide all values where there is no data
ac-61 Oct 14, 2024
0c4f941
Add js-colormaps library
ac-61 Oct 15, 2024
5472e04
Working color ramp for single band 8bit images
ac-61 Oct 28, 2024
f9ad4e0
Add fillMinMax for single band 8 bit images
ac-61 Oct 28, 2024
606b3b2
Support color ramps for single band images
ac-61 Nov 12, 2024
6eb28cd
Leaflet v1.5.1 patched with PR 6522
ac-61 Nov 21, 2024
8021d54
Fix opacity issues when zooming
ac-61 Nov 21, 2024
5b9f1b7
Export colormap data variable
ac-61 Dec 2, 2024
e06e829
Add symlink to js-colormaps library
ac-61 Dec 2, 2024
4bde241
Add color ramp selection dropdown for image layers
ac-61 Dec 2, 2024
28c3b8d
Clear georaster layer cache before updating colors
ac-61 Jan 9, 2025
0512c20
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Jan 15, 2025
a5a68bf
Working on updating image vars to match tile vars
ac-61 Jan 27, 2025
5446fc5
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Jan 28, 2025
79c1fe2
Add helper script to generate list of colormaps from TiTiler and js-c…
ac-61 Jan 29, 2025
268c8b5
Add updated js-colormaps to include colormaps from TiTiler
ac-61 Jan 29, 2025
70a4590
Load TiTler or js-colormap colormaps depending on TiTiler availability
ac-61 Jan 30, 2025
8b05e46
Merge remote-tracking branch 'origin/development' into ac-georaster-m…
ac-61 Jan 31, 2025
bd344b9
Clear geotiff cache when toggling layer visibility
ac-61 Feb 4, 2025
2daba9a
Remove extraneous import
ac-61 Feb 4, 2025
61c9827
Add image layer type to IdentifierTool
ac-61 Feb 5, 2025
c2585b6
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 10, 2025
5e7ccfe
Use minmax of image from gdalinfo if user did not input in layer sett…
ac-61 Feb 10, 2025
0ac8d91
Fix getUrl
tariqksoliman Feb 10, 2025
73e4571
Add extra checks
ac-61 Feb 10, 2025
8d2daf3
Add docs for Image layer
ac-61 Feb 10, 2025
5c3d414
Add missing elements in Image configuration
ac-61 Feb 11, 2025
e7c4c3d
Fix issue with loading COG scale text in LayerTool
ac-61 Feb 11, 2025
3af2335
Make id for titiler colomap images more specific
ac-61 Feb 11, 2025
4f364cb
Fix colormap dropdown to include velocity layer's DEFAULT colormap value
ac-61 Feb 11, 2025
b3ea3b8
Make legends for Tile COG and Image layers load upon start
ac-61 Feb 12, 2025
3643a25
Supress js-colormap alerts and print to console insteaad
ac-61 Feb 12, 2025
3717dfc
Add legend for velocity layer
ac-61 Feb 13, 2025
108f9e8
Add constant and todo note
ac-61 Feb 13, 2025
2944567
Use latest packages
ac-61 Feb 13, 2025
ec082fc
Clean up code
ac-61 Feb 13, 2025
fad9acb
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 13, 2025
154dc37
Update generated files
ac-61 Feb 13, 2025
82c91b2
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 24, 2025
0348baa
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 26, 2025
814552a
Check to if layer has cogTransform parameter before updating
ac-61 Feb 26, 2025
4937555
Fix loading of image layers
ac-61 Feb 26, 2025
0059b26
Fix conditions for fillMinMax
ac-61 Feb 26, 2025
16f96c4
Show correct image layer if reordering layers in UI
ac-61 Feb 27, 2025
0789bf0
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 27, 2025
96ac350
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Feb 28, 2025
20a9e32
Do not trim whitespace for layer name and units
ac-61 Feb 28, 2025
ed73c93
Undo Leaflet v1.5.1 patched with PR 6522 commit
ac-61 Mar 3, 2025
e0d8224
Only display cogTransform options on single band images
ac-61 Mar 3, 2025
4743a24
Update docs
ac-61 Mar 3, 2025
b79f05c
Use TiTiler colormaps when appropriate
ac-61 Mar 4, 2025
6c4d74e
Show config dropdown colorramp using js-colormaps library if TiTiler …
ac-61 Mar 4, 2025
b922fee
Use RDYLBU_R as default color instead of DEFAULT for velocity layers
ac-61 Mar 4, 2025
addfe2a
Merge remote-tracking branch 'origin/development' into ac-georaster
ac-61 Mar 4, 2025
f895c13
Copy js-colormaps to avoid symlink
tariqksoliman Mar 4, 2025
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
2 changes: 1 addition & 1 deletion API/Backend/Config/routes/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ function addLayer(req, res, next, cb, forceConfig, caller = "addLayer") {
mission: "{mission_name}",
layer: {
name: "{new_layer_name}",
type: "header || vector || vectortile || query || model || tile || data",
type: "header || vector || vectortile || query || model || tile || data || image",
"more...": "...",
},
"placement?": {
Expand Down
10 changes: 10 additions & 0 deletions API/Backend/Config/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ const validateLayers = (config) => {
// Check model params (pos, rot, scale)
errs = errs.concat(isValidModelParams(layer));
break;
case "image":
// Check url
errs = errs.concat(isValidUrl(layer));
// Check zooms
errs = errs.concat(isValidZooms(layer));
break;
default:
errs = errs.concat(
err(`Unknown layer type: '${layer.type}'`, ["layers[layer].type"])
Expand Down Expand Up @@ -316,6 +322,10 @@ const fillInMissingFieldsWithDefaults = (layer) => {
layer.style = layer.style || {};
layer.style.className = layer.name.replace(/ /g, "").toLowerCase();
break;
case "image":
layer.style = layer.style || {};
layer.style.className = layer.name.replace(/ /g, "").toLowerCase();
break;
case "model":
break;
default:
Expand Down
19 changes: 19 additions & 0 deletions API/Backend/Utils/routes/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,25 @@ router.post("/getbands", function (req, res) {
);
});

//utils getminmax
router.post("/getminmax", function (req, res) {
const path = encodeURIComponent(req.body.path);
const bands = encodeURIComponent(req.body.bands);

execFile(
"python",
["private/api/gdalinfoMinMax.py", path, bands],
function (error, stdout, stderr) {
if (error) {
logger("warn", error);
res.status(400).send();
} else {
res.send(stdout);
}
}
);
});

//utils ll2aerll
router.post("/ll2aerll", function (req, res) {
const lng = encodeURIComponent(req.body.lng);
Expand Down
1 change: 1 addition & 0 deletions configuration/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function getClientEnvironment(publicUrl) {
THIRD_PARTY_COOKIES: process.env.THIRD_PARTY_COOKIES || "",
SKIP_CLIENT_INITIAL_LOGIN: process.env.SKIP_CLIENT_INITIAL_LOGIN || "",
IS_DOCKER: process.env.IS_DOCKER,
WITH_TITILER: process.env.WITH_TITILER,
}
);
// Stringify all values so we can feed into webpack DefinePlugin
Expand Down
2 changes: 1 addition & 1 deletion configuration/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ module.exports = function (webpackEnv) {
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
{
test: /\.(js|mjs)$/,
test: /\.(js|mjs|cjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve("babel-loader"),
options: {
Expand Down
2 changes: 1 addition & 1 deletion configure/public/toolConfigs.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions configure/src/components/Tabs/Layers/Layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import LanguageIcon from "@mui/icons-material/Language"; // Tile
import GridViewIcon from "@mui/icons-material/GridView"; // Vector tile
import ViewInArIcon from "@mui/icons-material/ViewInAr"; // Model
import AirIcon from "@mui/icons-material/Air"; // Velocity
import ImageIcon from '@mui/icons-material/Image'; // Image
import AddIcon from "@mui/icons-material/Add";

import VisibilityIcon from "@mui/icons-material/Visibility";
Expand Down Expand Up @@ -386,6 +387,9 @@ export default function Layers() {
case "velocity":
iconType = <AirIcon fontSize="small" />;
color = "#24807c";
case "image":
iconType = <ImageIcon fontSize="small" />;
color = "#b0518f";
break;
default:
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import tileConfig from "../../../../../metaconfigs/layer-tile-config.json";
import vectorConfig from "../../../../../metaconfigs/layer-vector-config.json";
import vectortileConfig from "../../../../../metaconfigs/layer-vectortile-config.json";
import velocityConfig from "../../../../../metaconfigs/layer-velocity-config.json";
import imageConfig from "../../../../../metaconfigs/layer-image-config.json";

const useStyles = makeStyles((theme) => ({
Modal: {
Expand Down Expand Up @@ -196,6 +197,10 @@ const LayerModal = (props) => {
config = velocityConfig;
break;

case "image":
config = imageConfig;
break;

default:
break;
}
Expand Down
103 changes: 84 additions & 19 deletions configure/src/core/Maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,31 +721,96 @@ const getComponent = (
</FormControl>
);

let domain =
window.mmgisglobal.NODE_ENV === "development"
? "http://localhost:8888/"
: window.mmgisglobal.ROOT_PATH || "";
if (domain.length > 0 && !domain.endsWith("/")) domain += "/";

let colormap_html
if (window.mmgisglobal.WITH_TITILER === "true") {
// Get colors from TiTiler if it is available
colormap_html = (
<div style={{width: "100%"}}>
<img id="titlerCogColormapImage" style={{height: "20px", width: "100%"}} src={`${domain}titiler/colorMaps/${dropdown_value.toLowerCase()}?format=png`} />
</div>
)
} else {
let colormap = dropdown_value
// js-colormaps data object only contains the non reversed color so we need to track if the color is reversed
let reverse = false

// TiTiler colormap variables are all lower case so we need to format them correctly for js-colormaps
if (colormap.toLowerCase().endsWith('_r')) {
colormap = colormap.substring(0, colormap.length - 2)
reverse = true
}

let index = Object.keys(colormapData).findIndex(v => {
return v.toLowerCase() === colormap.toLowerCase();
});

if (index > -1) {
colormap = Object.keys(colormapData)[index]
} else {
console.warn(`The colormap '${colormap}' does not exist`);
}

if (colormap in colormapData) {
colormap_html = colormapData[colormap].colors.map(
(hex) => {
return (
<div
className={c.colorDropdownArrayHex}
style={{ background: `rgb(${hex.map(v => {return Math.floor(v * 255)}).join(',')})` }}
></div>
);
}
)

if (reverse === true) {
colormap_html.reverse()
}
} else if (colormap === 'DEFAULT') {
// Default color for velocity layer
const defaultColors = [
'rgb(36,104, 180)',
'rgb(60,157, 194)',
'rgb(128,205,193 )',
'rgb(151,218,168 )',
'rgb(198,231,181)',
'rgb(238,247,217)',
'rgb(255,238,159)',
'rgb(252,217,125)',
'rgb(255,182,100)',
'rgb(252,150,75)',
'rgb(250,112,52)',
'rgb(245,64,32)',
'rgb(237,45,28)',
'rgb(220,24,32)',
'rgb(180,0,35)',
]

colormap_html = defaultColors.map(
(hex) => {
return (
<div
className={c.colorDropdownArrayHex}
style={{ background: `${hex}`}}
></div>
);
}
)
}
}

return (
<div>
{inlineHelp ? (
<>
{inner}
<div className={c.textArrayHexes}>
{typeof dropdown_value === "string"
? colormapData[dropdown_value] &&
colormapData[dropdown_value].colors
? colormapData[dropdown_value].colors.map((hex) => {
return (
<div
className={c.colorDropdownArrayHex}
style={{
background: `rgb(${hex
.map((v) => {
return Math.floor(v * 255);
})
.join(",")})`,
}}
></div>
);
})
: null
: null}
{colormap_html || null}
</div>
<Typography className={c.subtitle2}>
{com.description || ""}
Expand Down
70 changes: 46 additions & 24 deletions configure/src/core/injectables.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { calls } from "./calls";
import { data as colormapData } from '../external/js-colormaps.js'

const injectablesDefaults = {
TILE_MATRIX_SETS: ["WebMercatorQuad"],
COLORMAP_NAMES: ["viridis"],
VELOCITY_COLORMAP_NAMES: ["RDYLBU_R"],
};
// Initialize with reasonable defaults
const injectables = {
TILE_MATRIX_SETS: injectablesDefaults["TILE_MATRIX_SETS"],
COLORMAP_NAMES: injectablesDefaults["COLORMAP_NAMES"],
VELOCITY_COLORMAP_NAMES: injectablesDefaults["VELOCITY_COLORMAP_NAMES"],
};

export const getInjectables = () => {
getTileMatrixSets();
getColormapNames();
getColormapNames("COLORMAP_NAMES");
getColormapNames("VELOCITY_COLORMAP_NAMES");
};

export const inject = (configJson) => {
Expand Down Expand Up @@ -66,43 +70,61 @@ function getTileMatrixSets() {
}
}

function getColormapNames() {
const injectableName = "COLORMAP_NAMES";
function getColormapNames(injectableName) {
if (window.mmgisglobal.WITH_TITILER === "true") {
calls.api(
"titiler_colormapNames",
null,
(res) => {
// Get the intersection of colormaps from js-colormaps and TiTiler
const js_colormaps = Object.keys(colormapData).map((color => color.toLowerCase()));
let colormaps = res.colorMaps;
colormaps = colormaps.filter((color) => {
if (js_colormaps.includes(color.toLowerCase())) {
return color;
}

// js-colormaps only includes the non reversed names so check for the reverse
if (color.endsWith("_r") && js_colormaps.includes(color.substr(0, color.length - 2))) {
return color;
}
});

// Sort
colormaps.sort();

// ... new Set removes duplicates
injectables[injectableName] = [
...new Set(
injectablesDefaults["COLORMAP_NAMES"].concat(res.colorMaps)
injectablesDefaults[injectableName].concat(colormaps)
),
];
},
(res) => {
console.warn(`Failed to query for ${injectableName}. Using defaults.`);
injectables[injectableName] = [
"gist_earth",
"gist_earth_r",
"gist_gray",
"gist_gray_r",
"gist_heat",
"gist_heat_r",
"gist_ncar",
"gist_ncar_r",
"gist_rainbow",
"gist_rainbow_r",
"gist_stern",
"gist_stern_r",
"gist_yarg",
"gist_yarg_r",
"terrain",
"terrain_r",
"viridis",
"viridis_r",
];
injectables[injectableName] = Object.keys(colormapData);
}
);
} else {
// Get colormaps from js-colormaps and the inversed colors
const js_colormaps = Object.keys(colormapData).map((color => color.toLowerCase()));
let colormaps = [];
js_colormaps.forEach((color) => {
colormaps.push(color);
// js-colormaps only includes the non reversed names so add the reverse
if (!color.endsWith("_r")) {
colormaps.push(`${color}_r`);
}
});

// Sort
colormaps.sort();

// ... new Set removes duplicates
injectables[injectableName] = [
...new Set(
injectablesDefaults[injectableName].concat(colormaps)
),
];
}
}
240 changes: 0 additions & 240 deletions configure/src/external/js-colormaps.js

This file was deleted.

291 changes: 291 additions & 0 deletions configure/src/external/js-colormaps.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions configure/src/metaconfigs/layer-data-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"options": [
"data",
"header",
"image",
"model",
"query",
"tile",
Expand Down
1 change: 1 addition & 0 deletions configure/src/metaconfigs/layer-header-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"options": [
"data",
"header",
"image",
"model",
"query",
"tile",
Expand Down
Loading
Loading