예제 #1
0
파일: lcc.py 프로젝트: robinrowe/PyGeodesy
    def __init__(self, e, n, h=0, conic=Conics.WRF_Lb, name=''):
        '''New L{Lcc} position.

           @param e: Easting (C{meter}).
           @param n: Northing (C{meter}).
           @keyword h: Optional height (C{meter}).
           @keyword conic: Optional, the conic projection (L{Conic}).
           @keyword name: Optional name (C{str}).

           @return: The Lambert location (L{Lcc}).

           @raise TypeError: If I{conic} is not L{Conic}.

           @raise ValueError: If I{e} or I{n} is invalid or negative.

           @example:

           >>> lb = Lcc(448251, 5411932.0001)
        '''
        if not isinstance(conic, Conic):
            raise TypeError('%s not Conic: %r' % ('conic', conic))
        self._conic = conic
        self._easting = false2f(e, 'easting', false=conic.E0 > 0)
        self._northing = false2f(n, 'northing', false=conic.N0 > 0)
        if h:
            self._height = float(h)
        if name:
            self.name = name
예제 #2
0
    def __init__(self, easting, northing, name=''):
        '''New OSGR National Grid Reference.

           @param easting: Easting from OS false easting (C{meter}).
           @param northing: Northing from from OS false northing (C{meter}).
           @keyword name: Optional name (C{str}).

           @raise ValueError: Invalid I{easting} or I{northing}.

           @example:

           >>> from pygeodesy import Osgr
           >>> r = Osgr(651409, 313177)
        '''
        if name:
            self.name = name

        self._easting = false2f(easting, 'easting')
        self._northing = false2f(northing, 'northing')