コード例 #1
0
ファイル: testMgrs.py プロジェクト: tranngocphu/PyGeodesy
    def testMgrs(self, LatLon):

        m = mgrs.Mgrs('31U', 'DQ', 48251, 11932)
        self.test('Mgrs1', str(m), '31U DQ 48251 11932')
        self.test('Mgrs1', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        m = mgrs.parseMGRS('31U DQ 48251, 11932')
        self.test('Mgrs2', str(m), '31U DQ 48251 11932')
        self.test('Mgrs2', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        m = mgrs.parseMGRS('31UDQ4825111932')
        self.test('Mgrs3', str(m), '31U DQ 48251 11932')
        self.test('Mgrs3', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        u = m.toUtm()
        self.test('toUtm1', str(u), '31 N 448251 5411932')
        self.test('toUtm1', repr(u), '[Z:31U, H:N, E:448251, N:5411932]')

        m = u.toMgrs()
        self.test('toMgrs', str(m), '31U DQ 48251 11932')

        for lat, lon, x in (
            (60.0, 1.0, '31V CG 88455 53097'),  # southern Norway
            (60.0, 3.0, '32V JM 65640 66593'),
            (60.0, 9.0, '32V NM 00000 51411'),
            (76.0, 1.0, '31X DE 45999 36099'),  # Svalbard
            (76.0, 13.0, '33X VE 45999 36099'),
            (76.0, 25.0, '35X ME 45999 36099'),
            (76.0, 37.0, '37X DE 45999 36099')):
            p = LatLon(lat, lon)
            m = p.toUtm().toMgrs()
            self.test('toUtm(%s).toMgrs' % (p, ), m, x)
コード例 #2
0
ファイル: testMgrs.py プロジェクト: mzy2240/PyGeodesy
    def testMgrs(self, LatLon):

        m = mgrs.Mgrs('31U', 'DQ', 48251, 11932)
        self.test('Mgrs1', str(m), '31U DQ 48251 11932')
        self.test('Mgrs1', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        m = mgrs.parseMGRS('31U DQ 48251, 11932')
        self.test('Mgrs2', str(m), '31U DQ 48251 11932')
        self.test('Mgrs2', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        # courtesy Richard Wright
        m = mgrs.parseMGRS('42SXD0970538646')
        self.test('Mgrs3', str(m), '42S XD 09705 38646')
        self.test('Mgrs3', repr(m), '[Z:42S, G:XD, E:09705, N:38646]')

        # courtesy Richard Wright
        m = mgrs.parseMGRS('42SXD1970508646')
        self.test('Mgrs4', str(m), '42S XD 19705 08646')
        self.test('Mgrs4', repr(m), '[Z:42S, G:XD, E:19705, N:08646]')

        m = mgrs.parseMGRS('42SXD1938')  # 2 digits means Km
        self.test('Mgrs5', str(m), '42S XD 19000 38000')  # meter
        self.test('Mgrs5', repr(m), '[Z:42S, G:XD, E:19000, N:38000]')

        m = mgrs.parseMGRS('31UDQ4825111932')
        self.test('Mgrs6', str(m), '31U DQ 48251 11932')
        self.test('Mgrs6', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        u = m.toUtm()
        self.test('toUtm1', str(u), '31 N 448251 5411932')
        self.test('toUtm1', repr(u), '[Z:31U, H:N, E:448251, N:5411932]')

        p = m.parse('31UDQ4825111932')  # coverage
        self.test('toUtm(None)', p.toUtm(None),
                  "(31, 'N', 448251.0, 5411932.0)")
        for a, x in (('easting', 48251.0), ('northing', 11932.0),
                     ('en100k', 'DQ'), ('digraph', 'DQ'), ('zone', 31),
                     ('band', 'U'), ('bandLatitude', 48)):
            self.test(a, getattr(p, a), x)

        m = u.toMgrs()
        self.test('toMgrs', str(m), '31U DQ 48251 11932')

        for lat, lon, x in (
            (60.0, 1.0, '31V CG 88455 53097'),  # southern Norway
            (60.0, 3.0, '32V JM 65640 66593'),
            (60.0, 9.0, '32V NM 00000 51411'),
            (76.0, 1.0, '31X DE 45999 36099'),  # Svalbard
            (76.0, 13.0, '33X VE 45999 36099'),
            (76.0, 25.0, '35X ME 45999 36099'),
            (76.0, 37.0, '37X DE 45999 36099')):
            p = LatLon(lat, lon)
            m = p.toUtm().toMgrs()
            self.test('toUtm(%s).toMgrs' % (p, ), m, x)
コード例 #3
0
    def testMgrs(self, LatLon):

        m = mgrs.Mgrs('31U', 'DQ', 48251, 11932)
        self.test('Mgrs1', str(m), '31U DQ 48251 11932')
        self.test('Mgrs1', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        m = mgrs.parseMGRS('31U DQ 48251, 11932')
        self.test('Mgrs2', str(m), '31U DQ 48251 11932')
        self.test('Mgrs2', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        # courtesy Richard Wright
        m = mgrs.parseMGRS('42SXD0970538646')
        self.test('Mgrs3', str(m), '42S XD 09705 38646')
        self.test('Mgrs3', repr(m), '[Z:42S, G:XD, E:09705, N:38646]')

        # courtesy Richard Wright
        m = mgrs.parseMGRS('42SXD1970508646')
        self.test('Mgrs4', str(m), '42S XD 19705 08646')
        self.test('Mgrs4', repr(m), '[Z:42S, G:XD, E:19705, N:08646]')

        m = mgrs.parseMGRS('42SXD1938')  # 2 digits means Km
        self.test('Mgrs5', str(m), '42S XD 19000 38000')  # meter
        self.test('Mgrs5', repr(m), '[Z:42S, G:XD, E:19000, N:38000]')

        m = mgrs.parseMGRS('31UDQ4825111932')
        self.test('Mgrs6', str(m), '31U DQ 48251 11932')
        self.test('Mgrs6', repr(m), '[Z:31U, G:DQ, E:48251, N:11932]')

        u = m.toUtm()
        self.test('toUtm1', str(u), '31 N 448251 5411932')
        self.test('toUtm1', repr(u), '[Z:31U, H:N, E:448251, N:5411932]')

        m = u.toMgrs()
        self.test('toMgrs', str(m), '31U DQ 48251 11932')

        for lat, lon, x in ((60.0,  1.0, '31V CG 88455 53097'),  # southern Norway
                            (60.0,  3.0, '32V JM 65640 66593'),
                            (60.0,  9.0, '32V NM 00000 51411'),
                            (76.0,  1.0, '31X DE 45999 36099'),  # Svalbard
                            (76.0, 13.0, '33X VE 45999 36099'),
                            (76.0, 25.0, '35X ME 45999 36099'),
                            (76.0, 37.0, '37X DE 45999 36099')):
            p = LatLon(lat, lon)
            m = p.toUtm().toMgrs()
            self.test('toUtm(%s).toMgrs' % (p,), m, x)