This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new b227612 Added guard statement for spatial controls (#4124)
b227612 is described below
commit b227612f6ec72cde19695add4c297e802d64449c
Author: Hugh A. Miles II <[email protected]>
AuthorDate: Tue Dec 26 12:27:27 2017 -0800
Added guard statement for spatial controls (#4124)
---
superset/viz.py | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/superset/viz.py b/superset/viz.py
index bb052d1..e649456 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1848,26 +1848,27 @@ class BaseDeckGLViz(BaseViz):
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'):
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].