def get_positions(self, table=None): if table is None: table = self.get_input("table") lat_col_idx = self.force_get_input('latitudeColIdx') lat_col_name = self.force_get_input('latitudeColName') lng_col_idx = self.force_get_input('longitudeColIdx') lng_col_name = self.force_get_input('longitudeColName') if lat_col_idx is None and lat_col_name is None: lat_idx = self.get_input('latitudeColIdx') # default 0 else: lat_idx = choose_column(table.columns, table.names, lat_col_name, lat_col_idx) if lng_col_idx is None and lng_col_name is None: lng_idx = self.get_input('longitudeColIdx') # default 1 else: lng_idx = choose_column(table.columns, table.names, lng_col_name, lng_col_idx) lat_col = table.get_column(lat_idx, True) lng_col = table.get_column(lng_idx, True) center = (sum(float(x) for x in lat_col) / len(lat_col), sum(float(x) for x in lng_col) / len(lng_col)) positions = [] for i in xrange(table.rows): positions.append(GMapLatLng(lat_col[i], lng_col[i])) return (positions, center)
def get_positions(self, table=None): if table is None: table = self.get_input("table") lat_col_idx = self.force_get_input('latitudeColIdx') lat_col_name = self.force_get_input('latitudeColName') lng_col_idx = self.force_get_input('longitudeColIdx') lng_col_name = self.force_get_input('longitudeColName') if lat_col_idx is None and lat_col_name is None: lat_idx = self.get_input('latitudeColIdx') # default 0 else: lat_idx = choose_column(table.columns, table.names, lat_col_name, lat_col_idx) if lng_col_idx is None and lng_col_name is None: lng_idx = self.get_input('longitudeColIdx') # default 1 else: lng_idx = choose_column(table.columns, table.names, lng_col_name, lng_col_idx) lat_col = table.get_column(lat_idx, True) lng_col = table.get_column(lng_idx, True) center = (sum(float(x) for x in lat_col)/len(lat_col), sum(float(x) for x in lng_col)/len(lng_col)) positions = [] for i in xrange(table.rows): positions.append(GMapLatLng(lat_col[i], lng_col[i])) return (positions, center)
def get_values(self, table=None): if table is None: table = self.get_input("table") value_col_idx = self.force_get_input("valueColIdx") value_col_name = self.force_get_input("valueColName") if value_col_idx is None and value_col_name is None: value_idx = self.get_input("valueColIdx") # default 2 else: value_idx = choose_column(table.columns, table.names, value_col_name, value_col_idx) value_col = table.get_column(value_idx, True) return value_col
def get_values(self, table=None): if table is None: table = self.get_input("table") value_col_idx = self.force_get_input("valueColIdx") value_col_name = self.force_get_input("valueColName") if value_col_idx is None and value_col_name is None: value_idx = self.get_input("valueColIdx") # default 2 else: value_idx = choose_column(table.columns, table.names, value_col_name, value_col_idx) value_col = table.get_column(value_idx, True) return value_col
def get_titles(self, table=None, default_col=None): if table is None: table = self.get_input("table") title_col_idx = self.force_get_input('titleColIdx') title_col_name = self.force_get_input('titleColName') print "title_col_idx:", title_col_idx print "title_col_name:", title_col_name if (title_col_idx is None and title_col_name is None and default_col is not None and default_col < table.columns): # only allow default if in range title_col_idx = default_col if title_col_idx is not None or title_col_name is not None: title_idx = choose_column(table.columns, table.names, title_col_name, title_col_idx) title_col = table.get_column(title_idx) return title_col return None
def get_titles(self, table=None, default_col=None): if table is None: table = self.get_input("table") title_col_idx = self.force_get_input('titleColIdx') title_col_name = self.force_get_input('titleColName') print "title_col_idx:", title_col_idx print "title_col_name:", title_col_name if (title_col_idx is None and title_col_name is None and default_col is not None and default_col < table.columns): # only allow default if in range title_col_idx = default_col if title_col_idx is not None or title_col_name is not None: title_idx = choose_column(table.columns, table.names, title_col_name, title_col_idx) title_col = table.get_column(title_idx) return title_col return None