superset
superset copied to clipboard
Got error when use `deck.gl Scatterplot` with type `Delimited`.
Got error when use deck.gl Scatterplot
with type Delimited
.
How to reproduce the bug
- create a new Chart
- Choose
deck.gl Scatterplot
- Choose
Delimited long & lat single column
- The column result is
110.1926929869672,30.737983766034915
- See error:
Invalid spatial point encountered
. - Choose
Reverse lat/long
still got same error.
Expected results
Correct show Chart.
Actual results
Got Error:
Invalid spatial point encountered
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
(please complete the following information):
- browser type and version: Google Chrome 98.0.4758.109
- superset version: Unknown
- python version: Unknown
- node.js version: Unknown
- any feature flags active: No
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
When the type is "delimited", lngLat
should be converted to latLng
before "parse_coordinates".
Otherwise an illegal lat
or lng
will cause an exception
https://github.com/apache/superset/blob/299b5dc64448d04abe6b35ee85fbd2b938c781bc/superset/viz.py#L2510-L2519
https://github.com/apache/superset/blob/299b5dc64448d04abe6b35ee85fbd2b938c781bc/superset/viz.py#L2542-L2551
https://geopy.readthedocs.io/en/stable/#geopy.point.Point
Thanks for reporting @xyy94813 . I agree we would need for the reversal to happen before or during parsing. On quick inspection it seems the best solution would be to open a PR on geopy
to add an optional parameter to the Point
constructor so the parser knows to default to latLng
when no directional indicators are provided. This shouldn't be very difficult and would probably benefit the whole geopy
community.
A workaround before it fix.
DB Column is lngLat, ie 112,23
Add new Metric
or Calculated Columns
.
(I still don't understand the difference between the two)
# SQL Expression
split_part(lngLat, ',', 1) # lng
split_part(lngLat, ',', 2) # lat
Then you can use the type Longitude & Latitude
@yousoph Any progress?
Hi @xyy94813 , are you testing on master? I'm seeing this working on master with data that looks like this:
@yousoph
The wrong test case is lng,lat
column, ie -122.428577,37.7806267
.
And
https://github.com/geopy/geopy/discussions/565
Ah, my bad, we're not currently working on it if you feel up to contributing a fix! 🙏
If anyone reading this wants to review the linked PR, it would be appreciated! Also, I assume this is still present in 3.1/4.0 (the currently supported versions) but confirmation would be appreciated.