From 4002d79e5198d87c9820da71f24f5ff0ab1af6c0 Mon Sep 17 00:00:00 2001 From: Sujit Date: Fri, 15 Nov 2024 15:38:04 +0545 Subject: [PATCH 1/2] feat: make required changes for cluster on map libre version updation to 4 --- .../MapSection/VectorLayerWithCluster.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/components/Projects/MapSection/VectorLayerWithCluster.tsx b/src/frontend/src/components/Projects/MapSection/VectorLayerWithCluster.tsx index 2295a2b2..59e5f04e 100644 --- a/src/frontend/src/components/Projects/MapSection/VectorLayerWithCluster.tsx +++ b/src/frontend/src/components/Projects/MapSection/VectorLayerWithCluster.tsx @@ -68,20 +68,18 @@ export default function VectorLayerWithCluster({ }); // inspect a cluster on click - map.on('click', 'clusters', (e: any) => { + map.on('click', 'clusters', async (e: any) => { const features = map.queryRenderedFeatures(e.point, { layers: ['clusters'], }); const clusterId = features[0].properties.cluster_id; - map + const zoom = await map .getSource(sourceId) - .getClusterExpansionZoom(clusterId, (err: any, zoom: any) => { - if (err) return; - map.easeTo({ - center: features[0].geometry.coordinates, - zoom, - }); - }); + .getClusterExpansionZoom(clusterId); + map.easeTo({ + center: features[0].geometry.coordinates, + zoom, + }); }); map.on('mouseenter', 'clusters', () => { From c5e9ae42c8ac889b16bb72bb079d0b0080f03303 Mon Sep 17 00:00:00 2001 From: Sujit Date: Fri, 15 Nov 2024 16:12:13 +0545 Subject: [PATCH 2/2] feat: add `COG_URL` --- .env.example | 1 + .../DroneOperatorTask/ModalContent/TaskOrthophotoPreview.tsx | 4 ++-- src/frontend/vite.config.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 0ded43ef..815265be 100644 --- a/.env.example +++ b/.env.example @@ -47,6 +47,7 @@ SITE_NAME=${SITE_NAME:-"DTM-Drone Tasking Manager"} BASE_URL=${BASE_URL:-http://localhost:8000/api} API_URL_V1=${API_URL_V1:-http://localhost:8000/api} NODE_ODM_URL=${NODE_ODM_URL:-http://odm-api:3000} +COG_URL=${COG_URL} ### ODM ### diff --git a/src/frontend/src/components/DroneOperatorTask/ModalContent/TaskOrthophotoPreview.tsx b/src/frontend/src/components/DroneOperatorTask/ModalContent/TaskOrthophotoPreview.tsx index ab48fe26..902068be 100644 --- a/src/frontend/src/components/DroneOperatorTask/ModalContent/TaskOrthophotoPreview.tsx +++ b/src/frontend/src/components/DroneOperatorTask/ModalContent/TaskOrthophotoPreview.tsx @@ -8,7 +8,7 @@ import { LngLatBoundsLike, RasterSourceSpecification } from 'maplibre-gl'; import { useEffect, useMemo } from 'react'; import { useDispatch } from 'react-redux'; -const { S3_ENDPOINT } = process.env; +const { COG_URL } = process.env; const TaskOrthophotoPreview = () => { const dispatch = useDispatch(); @@ -35,7 +35,7 @@ const TaskOrthophotoPreview = () => { const orthophotoSource: RasterSourceSpecification = useMemo( () => ({ type: 'raster', - url: `cog://${S3_ENDPOINT}/dtm-data/projects/${projectId}/${taskId}/orthophoto/odm_orthophoto.tif`, + url: `cog://${COG_URL}/dtm-data/projects/${projectId}/${taskId}/orthophoto/odm_orthophoto.tif`, tileSize: 256, }), diff --git a/src/frontend/vite.config.ts b/src/frontend/vite.config.ts index 6e3900ca..b96e6fc8 100644 --- a/src/frontend/vite.config.ts +++ b/src/frontend/vite.config.ts @@ -46,7 +46,7 @@ export default defineConfig({ API_URL_V1: process.env.API_URL_V1, SITE_NAME: process.env.SITE_NAME, STATIC_BASE_URL: process.env.STATIC_BASE_URL, - S3_ENDPOINT: process.env.S3_ENDPOINT, + COG_URL: process.env.COG_URL, }, }, server: {