Ejemplo n.º 1
0
    def lat(self, lat):
        '''Set the latitude.

           @param lat: New latitude (C{str[N|S]} or C{degrees}).

           @raise ValueError: Invalid I{lat}.
        '''
        lat = parseDMS(lat, suffix='NS', clip=90)
        self._update(lat != self._lat)
        self._lat = lat
Ejemplo n.º 2
0
    def lon(self, lon):
        '''Set the longitude.

           @param lon: New longitude (C{str[E|W]} or C{degrees}).

           @raise ValueError: Invalid I{lon}.
        '''
        lon = parseDMS(lon, suffix='EW', clip=180)
        self._update(lon != self._lon)
        self._lon = lon
Ejemplo n.º 3
0
    def __init__(self, lat, lon, height=0):
        '''New LatLon.

           @param lat: Latitude (degrees or DMS string with N or S suffix).
           @param lon: Longitude (degrees or DMS string with E or W suffix).
           @keyword height: Optional height (meter above or below the earth surface).

           @return: New instance (LatLon).

           @raise ValueError: Invalid lat or lon.

           @example:

           >>> p = LatLon(50.06632, -5.71475)
           >>> q = LatLon('50°03′59″N', """005°42'53"W""")
        '''
        self._lat = parseDMS(lat, suffix='NS')
        self._lon = parseDMS(lon, suffix='EW')
        if height:  # elevation
            self._height = float(height)