Skip to content

Commit

Permalink
Merge pull request #336 from hotosm/feat/orthophoto-display
Browse files Browse the repository at this point in the history
Feat: update COG url
  • Loading branch information
suzit-10 authored Nov 15, 2024
2 parents 0f0eec7 + c5e9ae4 commit 36e006b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 36e006b

Please sign in to comment.