def _xyhs(lls, off=True, name='llis'): # map (lat, lon, h) to (x, y, h) in radians, offset as # x: 0 <= lon <= PI2, y: 0 <= lat <= PI if off is True # else x: -PI <= lon <= PI, y: -PI_2 <= lat <= PI_2 if off: xf = yf = 0.0 else: # undo offset xf, yf = PI, PI_2 try: for i, ll in enumerate(lls): yield (max(0.0, radiansPI2(ll.lon + 180.0)) - xf), \ (max(0.0, radiansPI( ll.lat + 90.0)) - yf), ll.height except AttributeError as x: raise HeightError(_item_sq(name, i), ll, txt=str(x))
def _xyhs(lls, off=True): # map (lat, lon, h) to (x, y, h) in radians, offset as # x: 0 <= lon <= PI2, y: 0 <= lat <= PI if off is True # else x: -PI <= lon <= PI, y: -PI_2 <= lat <= PI_2 if off: xf = yf = 0.0 else: # undo offset xf, yf = PI, PI_2 try: for ll in lls: yield (max(0.0, radiansPI2(ll.lon + 180.0)) - xf), \ (max(0.0, radiansPI( ll.lat + 90.0)) - yf), ll.height except AttributeError as x: raise HeightError('%s: %r' % (x, ll))