Skip to content

Commit

Permalink
Merge pull request #326 from hotosm/feat/orthophoto-display
Browse files Browse the repository at this point in the history
Feat/orthophoto display
  • Loading branch information
suzit-10 authored Nov 5, 2024
2 parents a6531b2 + 14b8761 commit 694155a
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ const TaskOrthophotoPreview = () => {
);

useEffect(() => {
if (!map || !isMapLoaded || !projectId || !taskId || !orhtophotoSource)
if (
!map ||
!isMapLoaded ||
!projectId ||
!taskId ||
!orhtophotoSource ||
!taskOutline
)
return;
const { bbox } = taskOutline.properties;
map?.fitBounds(bbox as LngLatBoundsLike, { padding: 50, duration: 500 });

map.addSource('ortho-photo', orhtophotoSource.source);
map.addLayer(orhtophotoSource.layer);
}, [map, isMapLoaded, projectId, taskId, orhtophotoSource]);

// zoom to layer in the project area
useEffect(() => {
if (!map || !isMapLoaded || !taskOutline) return;
const { bbox } = taskOutline.properties;
map?.fitBounds(bbox as LngLatBoundsLike, { padding: 50, duration: 500 });
}, [map, isMapLoaded, taskOutline]);
}, [map, isMapLoaded, projectId, taskId, orhtophotoSource, taskOutline]);

useEffect(() => {
return () => {
Expand Down

0 comments on commit 694155a

Please sign in to comment.