You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initialization of the map is too slow, the initialization is successful only about 4s, and before the initialization is successful, the longitude and latitude conversion algorithm will be called abnormally
public static Vector3 GetUnityPosFromLatlon(ArcGISPoint latLon)
{
var cartesianPosition = arcGISMapComponent.View.GeographicToWorld(latLon);
Vector3 result = hPRoot.TransformPoint(cartesianPosition).ToVector3();
// Check for NaN values
if (float.IsNaN(result.x) || float.IsNaN(result.y) || float.IsNaN(result.z))
{
Debug.LogWarning("GetUnityPosFromLatlon returned NaN. Returning default value.");
return Vector3.zero; // Return a default value (0, 0, 0) in case of NaN
}
return result; // Return the calculated result
}
public static ArcGISPoint GetLatLonFromUnityPos(Vector3 vec)
{
var worldPosition = hPRoot.InverseTransformPoint(vec.ToDouble3());
ArcGISPoint result = arcGISMapComponent.View.WorldToGeographic(worldPosition);
if (double.IsNaN(result.X) || double.IsNaN(result.Y) || double.IsNaN(result.Z))
{
Debug.LogWarning("GetLatLonFromUnityPos returned NaN. Returning default value.");
return new ArcGISPoint(0,0,0); // Return a default value (0, 0, 0) in case of NaN
}
return result;
}
Can you tell me why it's taking so long to initialize
The text was updated successfully, but these errors were encountered:
The initialization of the map is too slow, the initialization is successful only about 4s, and before the initialization is successful, the longitude and latitude conversion algorithm will be called abnormally
public static Vector3 GetUnityPosFromLatlon(ArcGISPoint latLon)
{
var cartesianPosition = arcGISMapComponent.View.GeographicToWorld(latLon);
Vector3 result = hPRoot.TransformPoint(cartesianPosition).ToVector3();
// Check for NaN values
if (float.IsNaN(result.x) || float.IsNaN(result.y) || float.IsNaN(result.z))
{
Debug.LogWarning("GetUnityPosFromLatlon returned NaN. Returning default value.");
return Vector3.zero; // Return a default value (0, 0, 0) in case of NaN
}
return result; // Return the calculated result
}
public static ArcGISPoint GetLatLonFromUnityPos(Vector3 vec)
{
var worldPosition = hPRoot.InverseTransformPoint(vec.ToDouble3());
ArcGISPoint result = arcGISMapComponent.View.WorldToGeographic(worldPosition);
if (double.IsNaN(result.X) || double.IsNaN(result.Y) || double.IsNaN(result.Z))
{
Debug.LogWarning("GetLatLonFromUnityPos returned NaN. Returning default value.");
return new ArcGISPoint(0,0,0); // Return a default value (0, 0, 0) in case of NaN
}
return result;
}
Can you tell me why it's taking so long to initialize
The text was updated successfully, but these errors were encountered: