Place gameobjects at coordinates at real time

I wanted to place gameobject at some coordinate position at runtime, I have coordinates and wanted to spawn a gameobject and place it at some coord, but when I change it with LongitudeLatitudeHeight property of CesiumGeoReference, it takes it to some very far place and cant be seen.

public void InstantiateProps(GameObject propPrefab)
{
    Transform props = Instantiate(propPrefab).transform;

   
    props.parent = geoReference.transform;
    props.position = Vector3.zero;
    props.localPosition = Vector3.zero;
    props.rotation = Quaternion.Euler(-90, 0, 0);

    props.GetComponent<MeshRenderer>().material.color = color;

    address = location.text;
    address = address.Replace(" ", "+");
    map.GetCoordinateData(address);

    CesiumGlobeAnchor anchor =props.gameObject.AddComponent<CesiumGlobeAnchor>();
    double3 coordinates = new double3(map.GetLongitude(), map.Getlatitude(), map.GetHeight());
    anchor.GetComponent<CesiumGlobeAnchor>().longitudeLatitudeHeight = coordinates;
    anchor.Restart();
    //props.position = Vector3.zero;
    //props.localPosition = Vector3.zero;


    //double3 pos = geoReference.TransformEarthCenteredEarthFixedPositionToUnity(coordinates);
    //props.transform.position = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);

}

This is the transform position after spawning

I can’t see anything obvious wrong with your code. Check that map.GetLongitude and map.GetLatitude are returning the correct units (degrees), and haven’t accidentally swapped longitude and latitude (it’s a common mistake, easy to make).

Just some small suggestions that shouldn’t actually affect anything… You can simplify this:

anchor.GetComponent<CesiumGlobeAnchor>().longitudeLatitudeHeight = coordinates;

To this:

anchor.longitudeLatitudeHeight = coordinates;

It is also not necessary to call Restart after setting the longitude/latitude/height.

Thanks @Kevin_Ring, I got the idea from this and I fixed the issue, so the issue was I was not getting right coordinates and when I fixed that, It worked fine.