Get Landscape Height Data In C++

I am trying to code to remesh landscape following the static mesh height. However, i am stuck on trying to get and update the landscape height as i am not sure which data should i call. Here is my code:

include “RemeshLandscapeComponent.h”
include “LandscapeComponent.h”
include “LandscapeInfo.h”
include “Components/StaticMeshComponent.h”
include “Engine/World.h”
include “DrawDebugHelpers.h”

// Sets default values for this component's properties URemeshLandscapeComponent::URemeshLandscapeComponent() {
// Set this component to be initialized when the game starts, and to be ticked every frame.  
PrimaryComponentTick.bCanEverTick = false;

}

void URemeshLandscapeComponent::RemeshLandscape()
{
AActor* Owner = GetOwner();
if (!Owner)
{
UE_LOG(LogTemp, Error, TEXT(“RemeshLandscapeComponent: Owner not found”));
return;
}
//Assuming landscape and static mesh are both present
ULandscapeComponent* LandscapeComponent = Cast(Owner->GetComponentByClass(ULandscapeComponent::StaticClass()));
UStaticMeshComponent* StaticMeshComponent = Cast(Owner->GetComponentByClass(UStaticMeshComponent::StaticClass()));

if (!LandscapeComponent || !StaticMeshComponent)
{
UE_LOG(LogTemp, Error, TEXT(“RemeshLandscapeComponent: Landscape or Static Mesh not found”));
return;
}

//Get the bounds of the static mesh
FBox StaticMeshBounds = StaticMeshComponent->Bounds.GetBox();

//Get the landscape size and number of quads
FVector LandscapeScale = LandscapeComponent->GetRelativeScale3D();
int32 LandscapeWidth = LandscapeComponent->ComponentSizeQuads;
int32 LandscapeHeight = LandscapeWidth;

//Get the landscape heightmap data?

//Get the landscape edit layer?
;

//Iterate through landscape quads and update height
for (int32 Y = 0; Y < LandscapeHeight; ++Y)
{
for (int32 X = 0; X < LandscapeWidth; ++X)
{
//Calculate landscape quad location
FVector LandscapeQuadLocation = LandscapeComponent->GetComponentLocation() + FVector(X * LandscapeScale.X, Y * LandscapeScale.Y, 0.0f);

//Project the location onto the static mesh
FVector ClosestPointOnMesh;
ClosestPointOnMesh.X = FMath::Clamp(LandscapeQuadLocation.X, StaticMeshBounds.Min.X, StaticMeshBounds.Max.X);
ClosestPointOnMesh.Y = FMath::Clamp(LandscapeQuadLocation.Y, StaticMeshBounds.Min.Y, StaticMeshBounds.Max.Y);
ClosestPointOnMesh.Z = FMath::Clamp(LandscapeQuadLocation.Z, StaticMeshBounds.Min.Z, StaticMeshBounds.Max.Z);

//Update landscape height based on the static mesh height
float NewHeight = ClosestPointOnMesh.Z;
LandscapeComponent->???(X, Y, NewHeight);
}
}

//Update the landscape
}