diff --git a/superset/viz.py b/superset/viz.py index d1a41b39a1b03..403ff59b39221 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2075,20 +2075,13 @@ def query_obj(self): return d def get_data(self, df): - fd = self.form_data - start_lat = df[fd.get('start_spatial').get('latCol')] - start_lon = df[fd.get('start_spatial').get('lonCol')] - end_lat = df[fd.get('end_spatial').get('latCol')] - end_lon = df[fd.get('end_spatial').get('lonCol')] - source_pos = list(zip(start_lon, start_lat)) - target_pos = list(zip(end_lon, end_lat)) - data = [] - for pos in list(zip(source_pos, target_pos)): + for item in self.process_spatial_data_obj(df): + pos = item.get('position') data.append({ - 'sourcePosition': pos[0], - 'targetPosition': pos[1], - }) + 'sourcePosition': pos[0], + 'targetPosition': pos[1], + }) return { 'arcs': data,