예제 #1
0
 def test_conversion_of_degrees_4(self):
     degree_point = points.WGSPoint(16.123456, 0, 0, 25.654321, 0, 0)
     long_deg, long_min, long_sec = converter.convert_degree_to_DMS(
         float(degree_point.long_deg))
     lat_deg, lat_min, lat_sec = converter.convert_degree_to_DMS(
         float(degree_point.lat_deg))
     dms_point = points.WGSPoint(long_deg, long_min, long_sec, lat_deg,
                                 lat_min, lat_sec)
     print(dms_point.to_string(CoordinateSystemString.WGS84_DMS.value))
     self.assertEqual(int(dms_point.long_deg), 16)
     self.assertEqual(int(dms_point.long_min), 7)
     self.assertEqual(str(dms_point.long_sec)[:5], '24.44')
     self.assertEqual(int(dms_point.lat_deg), 25)
     self.assertEqual(int(dms_point.lat_min), 39)
     self.assertEqual(str(dms_point.lat_sec)[:5], '15.55')
     utm_point = converter.degree_to_utm(degree_point)
     print(utm_point.to_string())
     self.assertEqual(utm_point.zone_number, 33)
     self.assertEqual(int(utm_point.easting), 612764)
     self.assertEqual(int(utm_point.northing), 2837881)
     self.assertEqual(utm_point.hemisphere, Hemisphere.NORTH)
     mgrs_point = converter.convert_UTM_to_MGRS(utm_point)
     print(mgrs_point.to_string())
     self.assertEqual(mgrs_point.zone, '33R')
     self.assertEqual(mgrs_point.square, 'XJ')
     self.assertEqual(mgrs_point.easting, 12764)
     self.assertEqual(mgrs_point.northing, 37881)
예제 #2
0
 def test_degree_to_UTM(self):
     point = points.WGSPoint(3, 0, 0, -10, 0, 0)
     p_1 = converter.degree_to_utm(point)
     print(p_1.to_string())
     self.assertEqual(p_1.zone_number, 31)
     self.assertEqual(p_1.hemisphere, Hemisphere.SOUTH)
     self.assertEqual(int(p_1.easting), 500000)
     self.assertEqual(int(p_1.northing), 8894587)
예제 #3
0
 def test_deg_to_mgrs3(self):
     point = points.WGSPoint(0, 32, 0, 0, 31, 0)
     long_deg = converter.convert_DMS_to_degree(point.long_deg,
                                                point.long_min,
                                                point.long_sec)
     lat_deg = converter.convert_DMS_to_degree(point.lat_deg, point.lat_min,
                                               point.lat_sec)
     deg_point = points.WGSPoint(long_deg, 0, 0, lat_deg, 0, 0)
     print('Deg point: ' +
           deg_point.to_string(CoordinateSystemString.WGS84_Degrees.value))
     p1 = self.__degree_to_mgrs(deg_point)
     print('With lib: ' + p1.to_string())
     p = converter.degree_to_utm(deg_point)
     print(p.to_string())
     p2 = converter.convert_UTM_to_MGRS(p)
     print('Without lib: ' + p2.to_string())
예제 #4
0
 def test_conversion_of_degrees_1(self):
     point = points.WGSPoint(0, 32, 0, 0, 31, 0)
     long_deg = converter.convert_decimal_minutes_to_degree(
         point.long_deg, point.long_min)
     lat_deg = converter.convert_decimal_minutes_to_degree(
         point.lat_deg, point.lat_min)
     degree_point = points.WGSPoint(long_deg, 0, 0, lat_deg, 0, 0)
     print(
         degree_point.to_string(CoordinateSystemString.WGS84_Degrees.value))
     self.assertEqual(str(degree_point.long_deg)[:8], '0.533333')
     self.assertEqual(str(degree_point.lat_deg)[:8], '0.516666')
     utm_point = converter.degree_to_utm(degree_point)
     print(utm_point.to_string())
     self.assertEqual(utm_point.zone_number, 31)
     self.assertEqual(int(utm_point.easting), 225447)
     self.assertEqual(int(utm_point.northing), 57160)
     self.assertEqual(utm_point.hemisphere, Hemisphere.NORTH)
     mgrs_point = converter.convert_UTM_to_MGRS(utm_point)
     print(mgrs_point.to_string())
     self.assertEqual(mgrs_point.zone, '31N')
     self.assertEqual(mgrs_point.square, 'BA')
     self.assertEqual(mgrs_point.easting, 25447)
     self.assertEqual(mgrs_point.northing, 57160)
예제 #5
0
 def test_conversion_of_degrees_7(self):
     point = points.WGSPoint(25, 59, 59.99, 67, 12, 58.99)
     long_deg = converter.convert_DMS_to_degree(point.long_deg,
                                                point.long_min,
                                                point.long_sec)
     lat_deg = converter.convert_DMS_to_degree(point.lat_deg, point.lat_min,
                                               point.lat_sec)
     degree_point = points.WGSPoint(long_deg, 0, 0, lat_deg, 0, 0)
     print(
         degree_point.to_string(CoordinateSystemString.WGS84_Degrees.value))
     self.assertEqual(str(degree_point.long_deg)[:8], '25.99999')
     self.assertEqual(str(degree_point.lat_deg)[:8], '67.21638')
     long_deg, long_min, long_sec = converter.convert_degree_to_DMS(
         degree_point.long_deg)
     lat_deg, lat_min, lat_sec = converter.convert_degree_to_DMS(
         degree_point.lat_deg)
     dms_point = points.WGSPoint(long_deg, long_min, long_sec, lat_deg,
                                 lat_min, lat_sec)
     print(dms_point.to_string(CoordinateSystemString.WGS84_DMS.value))
     self.assertEqual(int(dms_point.long_deg), 25)
     self.assertEqual(int(dms_point.long_min), 59)
     self.assertEqual(str(dms_point.long_sec)[:5], '59.99')
     self.assertEqual(int(dms_point.lat_deg), 67)
     self.assertEqual(int(dms_point.lat_min), 12)
     self.assertEqual(str(dms_point.lat_sec)[:5], '58.99')
     utm_point = converter.degree_to_utm(degree_point)
     print(utm_point.to_string())
     self.assertEqual(utm_point.zone_number, 35)
     self.assertEqual(int(utm_point.easting), 456786)
     self.assertEqual(int(utm_point.northing), 7455850)
     self.assertEqual(utm_point.hemisphere, Hemisphere.NORTH)
     mgrs_point = converter.convert_UTM_to_MGRS(utm_point)
     print(mgrs_point.to_string())
     self.assertEqual(mgrs_point.zone, '35W')
     self.assertEqual(mgrs_point.square, 'MQ')
     self.assertEqual(mgrs_point.easting, 56786)
     self.assertEqual(mgrs_point.northing, 55850)
예제 #6
0
 def test_conversion_of_degrees_2(self):
     point = points.WGSPoint(12, 32, 0, 2, 31, 0)
     long_deg = converter.convert_decimal_minutes_to_degree(
         point.long_deg, point.long_min)
     lat_deg = converter.convert_decimal_minutes_to_degree(
         point.lat_deg, point.lat_min)
     degree_point = points.WGSPoint(long_deg, 0, 0, lat_deg, 0, 0)
     print(
         degree_point.to_string(CoordinateSystemString.WGS84_Degrees.value))
     self.assertEqual(str(degree_point.long_deg)[:8], '12.53333')
     self.assertEqual(str(degree_point.lat_deg)[:8], '2.516666')
     long_deg, long_min, long_sec = converter.convert_degree_to_DMS(
         degree_point.long_deg)
     lat_deg, lat_min, lat_sec = converter.convert_degree_to_DMS(
         degree_point.lat_deg)
     dms_point = points.WGSPoint(long_deg, long_min, long_sec, lat_deg,
                                 lat_min, lat_sec)
     print(dms_point.to_string(CoordinateSystemString.WGS84_DMS.value))
     self.assertEqual(int(dms_point.long_deg), 12)
     self.assertEqual(int(dms_point.long_min), 32)
     self.assertEqual(int(dms_point.long_sec), 0)
     self.assertEqual(int(dms_point.lat_deg), 2)
     self.assertEqual(int(dms_point.lat_min), 31)
     self.assertEqual(int(dms_point.lat_sec), 0)
     utm_point = converter.degree_to_utm(degree_point)
     print(utm_point.to_string())
     self.assertEqual(utm_point.zone_number, 33)
     self.assertEqual(int(utm_point.easting), 225699)
     self.assertEqual(int(utm_point.northing), 278428)
     self.assertEqual(utm_point.hemisphere, Hemisphere.NORTH)
     mgrs_point = converter.convert_UTM_to_MGRS(utm_point)
     print(mgrs_point.to_string())
     self.assertEqual(mgrs_point.zone, '33N')
     self.assertEqual(mgrs_point.square, 'TC')
     self.assertEqual(mgrs_point.easting, 25699)
     self.assertEqual(mgrs_point.northing, 78428)
예제 #7
0
 def test_def(self):
     point = points.WGSPoint(3, 0, 0, -10, 0, 0)
     point = converter.degree_to_utm(point)
     print(point.to_string())