Camera.flyTo or Castesian3.toDegrees is not using the negative value of latitude

1. A concise explanation of the problem you're experiencing.

I am running Cesium v1.4.1 inside Cordova, my application is picking up the correct position from the device, however the negative value for latitude is ignored and the camera ends up positioned in the wrong hemisphere.

I have tried casting to a Number, two significant figures and even reversing the parameter to no avail.

Thanks in advance

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

    function flyToPosition(pos) {
        var latitude = Number(pos.coords.latitude).toFixed(2);
        var longitude = Number(pos.coords.longitude)toFixed(2);
            destination: Cesium.Cartesian3.fromDegrees(latitude, longitude, 4000000),
            duration: 0


   var options = {
    enableHighAccuracy: true,
    maximumAge: 3600000

    function onError(error) {
        alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');

    navigator.geolocation.getCurrentPosition(flyToPosition, onError, options);

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I would like to have the app start out above the current location for the user.

4. The Cesium version you're using, your operating system and browser.

Cesium v1.41, Android 7.0 & Chrome 65.0.3325.109

Hi Duncan,

Are you sure the lat and long are in degrees? If they are in radians use Cartesian3.fromRadiansArray.

You should probably avoid rounding the lat and long and use the raw values instead.



You’re passing the parameters to Cartesian3.fromDegrees in the wrong order.

Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid, result) → Cartesian3

Thanks very much to Scott and Gabby, yes it turned out I was passing the parameters in the wrong order. Very embarrassing.

thanks though

It’s easy to mix them up. :slight_smile:

Good catch, Scott!