Connect API units for lat/long

All …

Quick question – when retrieving an aircraft’s latitude and longitude in the Connect v2 API using a command like aircraft/0/latitude, what units are returned. The value is a Double and in a recent experiment with an aircraft sitting on the runway at KFSO I get back:

aircraft/0/latitude: -3.0480054032950045e+27
aircraft/0/longitude: -1.5358424532152526e-9

Looking at these values these clearly don’t appear to be the coordinates in degrees for any runway at KSFO. In fact the e+27 in the latitude makes the number so large (in the negative, of course) it simply can’t be a coordinate in degrees.

Can any one help me interpret these values? (Or just tell me the data is wrong and not meaningful?)

Thanks.

Do you know if it is in big endian or little endian format? Also, what language are you using?

1 Like

So … this is after converting the data returned by the API following all the documentation for endianness etc.

I have a Node application that has long been successfully consuming other values returned as Floats and Doubles from the API (such as for magnetic heading, etc). But for latitude and longitude I’m truly lost by the values I get back.

Not sure that really answers your question, but I am doing nothing different for these values than I do for other values returned such as magnetic heading, etc.

1 Like

These values should returned as doubles and in degrees. Not sure why you’re seeing this.

Are you getting more meaningful data if you load in at other airports?

Good question. I need to try other locations and probably other aircraft to compare.

1 Like

Give it a try and let me know. We use this value internally so it should be correct; if you could share a code sample if you’re unable to solve it, that could help too. Cheers!

1 Like

@Cameron … Looks like the problem is on me. Found a bug in my handling of buffer-to-double conversion in a specific use case. This was the root cause. All good now and getting back degrees as expected. Thanks!

3 Likes

Great, glad you solved that :)

1 Like