[solved] About Transform Location?

--------------------- :point_down: :point_down: :point_down:Mistake :disappointed_relieved:---------------------

InaccurateTransformLongitudeLatitudeHeightToUe
emmm…
This offset is so big…
I use v3(0,0,0) to WGS84
then WGS84 To v3(-17.433,1.635,15.265)
9.56meters?
image


little help?

Hello @ljason1993 ,

As you have found, the blueprint conversion functions are lossy since Unreal blueprints do not support double-precision floating point numbers. To use the double-precision versions of these conversion functions from CesiumGeoreference, you currently need to use C++.

We have this GitHub issue open for introducing double-precision wrapper types to allow for more accurate conversion functions within blueprint as well.

thank you so much :grinning:

1 Like

@Nithin_Pranesh emmm…
I use c++ to transform location…
but it’s same situation~~ :sob:

FString ACesiumMaker::VectorToWGS84(FString v3)
{
TArray<FString> v3List;
FString reslutString = "";
v3 = "0,0,0";
v3.ParseIntoArray(v3List, *FString(","),true);

// vector to wgs84
glm::dvec3 wgs84=cesiumGeoreference
	->TransformUeToLongitudeLatitudeHeight(glm::dvec3(
		FCString::Atod(*v3List[0]), 
		FCString::Atod(*v3List[1]),
		FCString::Atod(*v3List[2])));
reslutString = FString::SanitizeFloat(wgs84.x) +"--"+ 
	FString::SanitizeFloat(wgs84.y) + "--" + 
	FString::SanitizeFloat(wgs84.z);
UE_LOG(LogTemp, Log, TEXT(" >LJason< -------WGS84------- %s"), *reslutString);

// wgs84 to vector
glm::dvec3 resultV3=cesiumGeoreference->TransformLongitudeLatitudeHeightToUe(wgs84);
reslutString = FString::SanitizeFloat(resultV3.x) + "--" + 
	FString::SanitizeFloat(resultV3.y) + "--" + 
	FString::SanitizeFloat(resultV3.z);
UE_LOG(LogTemp, Log, TEXT(" >LJason<  -------Vector3------- %s"), *reslutString);

return reslutString;
}

LogTemp: >LJason< -------WGS84------- 112.0–25.0–950.0
LogTemp: >LJason< -------Vector3------- -17.432647–1.635343–15.265489
image

:sob:need help

Hi @ljason1993,

I just looked back at your original blueprint, the distance calculation looks wrong. The location variable is the longitude latitude height, but you are measuring the distance from the location variable to the unreal origin. The true magnitude of the error seems to be around 23 cm for both blueprint and C++, which is within the expected range.

OMG sorry for that :sob:
it’s a big error :sob:

@Nithin_Pranesh
thanks for your help
you can close this topic :grinning:

Hi,

That error sounded big to me too, so I checked into it and found a subtle bug. I opened a pull request with the fix:

Kevin

2 Likes

@Kevin_Ring :+1: :beers:

:+1: