示例#1
0
	def __init__(self):
		self.false_e = 500000.0
		self.false_n = 0.0
		self.scale = 0.9996
		self.zone_override = 0
		self.deg_to_rad = pi/180.0
		self.rad_to_deg = 180.0/pi
		self.tm = tranmerc()
示例#2
0
    def __init__(self):
	self.false_e = 500000.0
	self.false_n = 0.0
	self.scale = 0.9996
	self.zone_override = 0
        self.deg_to_rad = pi/180.0
        self.rad_to_deg = 180.0/pi
	self.tm = tranmerc()
示例#3
0
    def __init__(self):
	self.kp2000j = 0 # KP2000 Jylland (Jutland) & Fyn (Funen) projection 
	self.kp2000s = 1 # KP2000 Sjaelland (Sealand) projection
	self.kp2000b = 2 # KP2000 Bornholm projection
        self.deg_to_rad = pi/180.0
        self.rad_to_deg = 180.0/pi
	self.central_meridian = []
	for i in xrange(len(central_meridian)):
	    self.central_meridian.append(central_meridian[i]*self.deg_to_rad)
	self.tm = tranmerc()
示例#4
0
 def __init__(self):
     self.dktm1 = 0  # DKTM1 projection (West-Central Jutland
     self.dktm2 = 1  # DKTM2 projection (Central-East Jutland & Funen)
     self.dktm3 = 2  # DKTM3 projection (Sealand)
     self.dktm4 = 3  # DKTM4 projection (Borhnolm)
     self.deg_to_rad = pi / 180.0
     self.rad_to_deg = 180.0 / pi
     self.central_meridian = []
     for i in range(len(central_meridian)):
         self.central_meridian.append(central_meridian[i] * self.deg_to_rad)
     self.tm = tranmerc()
示例#5
0
文件: dktm.py 项目: Exchizz/frobomind
    def __init__(self):
	self.dktm1 = 0 # DKTM1 projection (West-Central Jutland
	self.dktm2 = 1 # DKTM2 projection (Central-East Jutland & Funen)
	self.dktm3 = 2 # DKTM3 projection (Sealand)
	self.dktm4 = 3 # DKTM4 projection (Borhnolm)
        self.deg_to_rad = pi/180.0
        self.rad_to_deg = 180.0/pi
	self.central_meridian = []
	for i in xrange(len(central_meridian)):
	    self.central_meridian.append(central_meridian[i]*self.deg_to_rad)
	self.tm = tranmerc()
示例#6
0
 def __init__(self, filename, skip_lines, max_lines):
     self.i = 0
     print 'Importing GPS data'
     file = open(filename, 'rb')
     file_content = csv.reader(file, delimiter=',')
     self.data = []
     i = 0
     origo_e = 0
     origo_n = 0
     tm = tranmerc()
     tm.set_params (wgs84_a, wgs84_f, utm_origin_latitude, \
         utm32_central_meridian, utm_false_easting, utm32_false_northing, utm_scale_factor)
     for time, lat, lon, fix, sat, hdop in file_content:
         if i > skip_lines:
             (easting,northing) = tm.geodetic_to_tranmerc (float(lat)*deg_to_rad, float(lon)*deg_to_rad)
             self.data.append([float(time), float(lat), float(lon), \
                 float(easting), float(northing), int(fix), int(sat), float(hdop)])
         i += 1
         if max_lines > 0 and i == max_lines:
             break
     file.close()
     self.length = len(self.data)
     print '\tTotal samples: %d' % (self.length) 
# general defines
deg_to_rad = pi/180.0
rad_to_deg = 180.0/pi
# WGS-84 defines
wgs84_a = 6378137.0 # WGS84 semi-major axis of ellipsoid [m]
wgs84_f = 1/298.257223563 # WGS84 flattening of ellipsoid
# UTM defines
utm_false_easting = 500000.0
utm_scale_factor = 0.9996
utm_origin_latitude = 0.0 * deg_to_rad
# UTM32 defines
utm32_central_meridian = 9.0 * deg_to_rad
utm32_false_northing = 0.0 * deg_to_rad

tm = tranmerc()
tm.set_params (wgs84_a, wgs84_f, utm_origin_latitude, utm32_central_meridian, utm_false_easting, utm32_false_northing, utm_scale_factor)
kp = kp2000conv()


def load_waypoints_geo(filename):
	pts = []
	lines = [line.rstrip('\n') for line in open(filename)] # read the file and strip \n
	for i in xrange(len(lines)): # for all lines
		if len(lines[i]) > 0 and lines[i][0] != '#': # if not a comment or empty line
			if lines[i][:7] == '\tPoint ':
				data = lines[i][7:].split (',') # split into comma separated list
				name = data[0]
				kp2000_n = float (data[1])
				kp2000_e = float (data[2])
				alt = float (data[3])
示例#8
0
argc = len(argv)
if argc != 4:
    print 'Usage: convert_waypoints.py format infile outfile'
    print 'Format: ll_utm32/utm32_ll/ll_kp2000j/kp2000j_ll'
else:
    conv = argv[1:][0]
    inf = argv[1:][1]
    outf = argv[1:][2]

    out_wpts = []

    if conv == 'll_utm32':
        print 'Convertion from geographical coordinates to UTM32...'
        in_wpts = load_from_csv(inf)
        tm = tranmerc()
        tm.set_params(wgs84_a, wgs84_f, utm_origin_latitude,
                      utm32_central_meridian, utm_false_easting,
                      utm32_false_northing, utm_scale_factor)
        for i in xrange(len(in_wpts)):
            (e, n) = tm.geodetic_to_tranmerc(in_wpts[i][0] * deg_to_rad,
                                             in_wpts[i][1] * deg_to_rad)
            out_wpts.append([e, n])
        save_tranmerc_to_csv(outf, out_wpts, '# Easting,Northing (UTM32)')
        print 'Quit'

    elif conv == 'utm32_ll':
        print 'Convertion from UTM32 to geographical coordinates...'
        in_wpts = load_from_csv(inf)
        tm = tranmerc()
        tm.set_params(wgs84_a, wgs84_f, utm_origin_latitude,