Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,26 +1848,27 @@ def query_obj(self):
def get_data(self, df):
fd = self.form_data
spatial = fd.get('spatial')
if spatial.get('type') == 'latlong':
df = df.rename(columns={
spatial.get('lonCol'): 'lon',
spatial.get('latCol'): 'lat'})
elif spatial.get('type') == 'delimited':
cols = ['lon', 'lat']
if spatial.get('reverseCheckbox'):
cols.reverse()
df[cols] = (
df[spatial.get('lonlatCol')]
.str
.split(spatial.get('delimiter'), expand=True)
.astype(np.float64)
)
del df[spatial.get('lonlatCol')]
elif spatial.get('type') == 'geohash':
latlong = df[spatial.get('geohashCol')].map(geohash.decode)
df['lat'] = latlong.apply(lambda x: x[0])
df['lon'] = latlong.apply(lambda x: x[1])
del df['geohash']
if spatial:
if spatial.get('type') == 'latlong':
df = df.rename(columns={
spatial.get('lonCol'): 'lon',
spatial.get('latCol'): 'lat'})
elif spatial.get('type') == 'delimited':
cols = ['lon', 'lat']
if spatial.get('reverseCheckbox'):
cols.reverse()
df[cols] = (
df[spatial.get('lonlatCol')]
.str
.split(spatial.get('delimiter'), expand=True)
.astype(np.float64)
)
del df[spatial.get('lonlatCol')]
elif spatial.get('type') == 'geohash':
latlong = df[spatial.get('geohashCol')].map(geohash.decode)
df['lat'] = latlong.apply(lambda x: x[0])
df['lon'] = latlong.apply(lambda x: x[1])
del df['geohash']

features = []
for d in df.to_dict(orient='records'):
Expand Down