def toStr(self, form=F_DMS, prec=None, m='m', sep=', '): # PYCHOK expected '''Convert this point to a "lat, lon [+/-height]" string, formatted in the given form. @keyword form: Use F_D, F_DM, F_DMS for deg°, deg°min', deg°min'sec" (string). @keyword prec: Number of decimal digits (0..8 or None). @keyword m: Unit of the height (string). @keyword sep: Separator to join (string). @return: Point in the specified form (string). @example: >>> LatLon(51.4778, -0.0016).toStr() # 51°28′40″N, 000°00′06″W >>> LatLon(51.4778, -0.0016).toStr(F_D) # 51.4778°N, 000.0016°W >>> LatLon(51.4778, -0.0016, 42).toStr() # 51°28′40″N, 000°00′06″W, +42.00m ''' t = [ latDMS(self.lat, form=form, prec=prec), lonDMS(self.lon, form=form, prec=prec) ] if self.height: t += ['%+.2f%s' % (self.height, m)] return sep.join(t)
def toStr(self, form=F_D, prec=6, sep=', ', **kwds): '''This L{LatLon_} as a string "<degrees>, <degrees>". @keyword form: Optional format, F_D, F_DM, F_DMS for deg°, deg°min′, deg°min′sec″ (C{str}). @keyword prec: Optional number of decimal digits (0..8 or C{None}). @keyword sep: Optional separator to join (C{str}). @keyword kwds: Optional, keyword arguments. @return: Instance (C{str}). ''' t = [ latDMS(self.lat, form=form, prec=prec), lonDMS(self.lon, form=form, prec=prec) ] if self.name: t += [repr(self.name)] if kwds: t += ['%s=%s' % _ for _ in sorted(kwds.items())] return sep.join(t)