Hello,
I'm trying to get the coordinates (Lat/ lon) of the player (main camera) with a button. But when i move in the game and hit the button the coordinates stays the same as the beginning.
GisLocation = Camera.main.GetComponent<ArcGISLocationComponent>();
//Afstand.text = "X: " + GisLocation.Position.X.ToString() + " Y: " + GisLocation.Position.Y.ToString() + " Z: " + GisLocation.Position.Z.ToString();
Debug.Log(GisLocation.Position.Y);
How can i access the coordinates.
HI WH1981. For getting coordinates from a position, I suggest using the `WorldToGeographic` method from `ArcGISView`.
ArcGISPoint geoPosition = mapComponent.View.WorldToGeographic(worldPosition);
I hope this helps,
Zack
Hello Zack, I now have this, but i need the worldPosition. How do i get that?
ArcGISPoint geoPosition = arcGISMapComponent.View.WorldToGeographic(worldPosition);
I find also this and worldpos is worldposition.
double3 worldPos = map.View.GeographicToWorld(new ArcGISPoint(x, y, spatialRef));
map = the ArcGISMapComponent; spatialRef = new ArcGISSpatialReference(4326); x,y = 5.1 & 52.1 (example)
But the x and y is filled in here. How do i get the Unity x and y of the camera position?
Update: found a solution. I place a empty object under the XR RIG. And add the ArcGIS Location component to it.
CoorXY = GameObject.FindWithTag("XY");
var GisLocation = CoorXY.GetComponent<ArcGISLocationComponent>();
text.text = GisLocation.Position.X.ToString() + GisLocationMain.Position.Y.ToString();