0

I don't know if this is supposed to happen, but it is definitely not what I want.

I have a python script that creates a kml file based on latitude, longitude and altitude from a database. Once the kml is created, everything looks fine, but the bearing gets messed up whenever you zoom out or get near +/- 90 latitude (the poles).

Does anyone know if this is a glitch with Google Earth or if this is how it is supposed to be? Does anyone know how to fix it?

Before you conclude that the arrows on Google Earth should reorient themselves, hear me out: the arrows on the map should point to the back of one another, and they do (most of the time). However, like I said, if you zoom out or get near the poles, then the arrows flip sideways.

I think the problem is that Google Earth assumes that the orientation of all of the Placemarks should be the same based on one Placemark, and thus the majority of the arrows point the wrong way in many instances.

Check this kml file out if you don't believe me... (Go to the north pole and move over it a couple of times and you should see what I am talking about.) (Also, after you download, right click and select open with... Google Earth - make sure you download it too.)

https://docs.google.com/file/d/0B_achbIA2bcBdnp5b3J3WlJ3U1U/edit?usp=drive_web

Any ideas?

dylnmc
  • 3,810
  • 4
  • 26
  • 42

1 Answers1

0

In your KML file, you are specifying the icon heading in the <heading> tag inside <IconStyle>. To me, it looks like your computation of bearing is producing the undesirable results. Are you doing something `bearing = atan2( (lon2-lat2)/(lat2 - lat1) ) in your code? If so, your calculations will blow up near the poles (and the bearings will be inaccurate). I suspect you're doing this type of calculation because the arrows are misaligned with the track as you proceed higher in latitude where that bearing calculation's error increases.

If you want to accurate compute bearing from subsequent lat-lon-alt pairs, I recommend converting the lat-lon-alt pairs into 3D Cartesian position vectors, approximating the velocity vector by finite difference, and then resolving the velocity direction in the North-East-Down coordinate system (or East-North-Up, if you prefer). Then you can solve accurately for bearing.

tl;dr: It's not Google Earth that's messing up. I think it's your bearing calculation.

zigzag
  • 415
  • 3
  • 7
  • Yes, I posted this on Google Groups as well, and I figured out that near the poles they would get really crazy. That's fine. I understand that the longitude has to flip 180 degrees when you cross the north pole so that you can go down the other side of the globe. My main concern is why the arrows change orientation when I zoom out and when I get close to the poles (regardless of if the arrows cross the pole or not). Thanks – dylnmc Sep 03 '14 at 17:53
  • Oh - I see the issue now that you've described - yeah that's definitely weird. Bug? – zigzag Sep 03 '14 at 17:55
  • Ok, so are you saying that it's not just when I cross the poles but rather the fact that the Earth is a sphere and using `tan` causes major issues? I didn't think of that~ – dylnmc Sep 03 '14 at 17:55