def __str__(self): name = self.name if self.name != '' else 'Empty' desc = self.desc if self.desc != '' else 'Empty' ufactor = user_units_per_meter(self.user_units) n, e, z = [d * ufactor for d in (self.y, self.x, self.z)] s = "{0},{1:.4f},{2:.4f},{3:.4f},{4}".format(name, n, e, z, desc) return s
for i in range(len(local_ref)): grid = grid_ref[i] print('\n{0:>6s} ({1}): {2:12.4f}, {3:12.4f} (samples={4}) {5}'.format( grid.name, grid.type, grid.x, grid.y, grid.samples, grid.desc)) local = local_ref[i] x, y = xfm.to_grid(local.x, local.y) dist = math.sqrt((x - grid.x)**2 + (y - grid.y)**2) print('{0:>6s} ({1}): {2:12.4f}, {3:12.4f} (error={4:.2f}) {5}' .format(local.name, local.type, local.x, local.y, dist, local.desc)) print('{0:>6s} ({1}): {2:12.4f}, {3:12.4f} (error={4:.2f}) {5}' .format(local.name, 'XFORM', x, y, dist, local.desc)) print() for p in grid_pts: ufactor = utils.user_units_per_meter('sft') x, y = xfm.to_local(p.x, p.y) x *= ufactor y *= ufactor z = p.z * ufactor print('{0:d},{1:.4f},{2:.4f},{3:.4f},RIVER'.format(int(p.name) + 1000, y, x, z)) filename_local_points = 'data/150419_Stapp_PTS.txt' filename_grid_points = 'data/Waypoints.gpx' projection = ProjectionLC('SPCS', '0401') local_pts = Point.read_local_points(filename_local_points, 'sft') if not local_pts: print("No points. Nothing to do.") exit(1)