From 8c7a4caf6abbf6c4f6a79f282ed94ef8129cacea Mon Sep 17 00:00:00 2001 From: Quinn <10715168+qugu2427@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:44:29 -0700 Subject: [PATCH] Lock wms crs input to epsg-3857 (issue 600) (#632) * locked custom wms crs input to epsg-2857 Signed-off-by: Quinn Guerin * updated changelog Signed-off-by: Quinn Guerin --------- Signed-off-by: Quinn Guerin Signed-off-by: Heemin Kim Co-authored-by: Quinn Guerin Co-authored-by: Heemin Kim --- CHANGELOG.md | 1 + .../layer_config/custom_map_config/custom_map_source.tsx | 2 ++ public/model/customLayerFunctions.ts | 3 +++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f9a01f..8d96a780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Features ### Enhancements ### Bug Fixes +* Locked custom wms crs input to epsg-3857 ([#632](https://github.com/opensearch-project/dashboards-maps/pull/632)) ### Infrastructure ### Documentation ### Maintenance diff --git a/public/components/layer_config/custom_map_config/custom_map_source.tsx b/public/components/layer_config/custom_map_config/custom_map_source.tsx index 2c680b91..f92fc008 100644 --- a/public/components/layer_config/custom_map_config/custom_map_source.tsx +++ b/public/components/layer_config/custom_map_config/custom_map_source.tsx @@ -267,6 +267,8 @@ export const CustomMapSource = ({ value={WMSCoordinateSystem} onChange={onChangeWMSCoordinateSystem} fullWidth={true} + value="EPSG:3857" + disabled /> diff --git a/public/model/customLayerFunctions.ts b/public/model/customLayerFunctions.ts index 5509de23..d8927dab 100644 --- a/public/model/customLayerFunctions.ts +++ b/public/model/customLayerFunctions.ts @@ -46,6 +46,9 @@ const getCustomMapURL = (layerConfig: CustomLayerSpecification) => { return layerSource?.url; } else if (layerSource?.customType === 'wms') { const referenceSystemName = layerSource.version === '1.3.0' ? 'crs' : 'srs'; + if (!layerSource.crs) { + layerSource.crs = "EPSG:3857" + } return `${layerSource?.url}?service=WMS&version=${layerSource.version}&request=GetMap&format=${layerSource.format}&transparent=true&layers=${layerSource?.layers}&styles=${layerSource.styles}&${referenceSystemName}=${layerSource.crs}&width=256&height=256&bbox={bbox-epsg-3857}`; } else { return '';