betodealmeida commented on a change in pull request #4460: [bugfix] allow
reversing geohash, disregard invalid
URL:
https://github.com/apache/incubator-superset/pull/4460#discussion_r170698909
##########
File path: superset/viz.py
##########
@@ -1949,17 +1949,23 @@ def tupleify(s):
df[key] = df[spatial.get('lonlatCol')].apply(tupleify)
- if spatial.get('reverseCheckbox'):
- df[key] = [
- tuple(reversed(o)) if isinstance(o, (list, tuple)) else
(0, 0)
- for o in df[key]
- ]
del df[spatial.get('lonlatCol')]
elif spatial.get('type') == 'geohash':
- latlong = df[spatial.get('geohashCol')].map(geohash.decode)
+ def try_geohash(h):
+ try:
+ latlng = geohash.decode(h)
+ except Exception as e:
+ latlng = (0, 0)
Review comment:
I'm worried about returning valid values where we have bad data. What
happens when a user filters on region (say, SFO), and then tries to average lat
and lon to look at some "average region" ? these invalid data points would skew
the result. It's an unlikely but not impossible scenario, and it would be hard
to troubleshoot.
Also, how does this play with your auto-zoom feature? Is the viz going to
zoom out in order to include this point when bad data is present?
Is there any way we can be explicit and return `None` here, and deal with it
higher in the stack?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services