superset icon indicating copy to clipboard operation
superset copied to clipboard

Got error when use `deck.gl Scatterplot` with type `Delimited`.

Open xyy94813 opened this issue 2 years ago • 8 comments

Got error when use deck.gl Scatterplot with type Delimited.

How to reproduce the bug

  1. create a new Chart
  2. Choose deck.gl Scatterplot
  3. Choose Delimited long & lat single column
  4. The column result is 110.1926929869672,30.737983766034915
  5. See error: Invalid spatial point encountered.
  6. 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

xyy94813 avatar Mar 04 '22 09:03 xyy94813

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.

villebro avatar Mar 07 '22 08:03 villebro

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

xyy94813 avatar Mar 09 '22 02:03 xyy94813

@yousoph Any progress?

xyy94813 avatar Nov 30 '23 02:11 xyy94813

Hi @xyy94813 , are you testing on master? I'm seeing this working on master with data that looks like this: image

yousoph avatar Dec 01 '23 01:12 yousoph

@yousoph

The wrong test case is lng,lat column, ie -122.428577,37.7806267. And image

xyy94813 avatar Dec 01 '23 03:12 xyy94813

https://github.com/geopy/geopy/discussions/565

xyy94813 avatar Dec 02 '23 15:12 xyy94813

Ah, my bad, we're not currently working on it if you feel up to contributing a fix! 🙏

yousoph avatar Dec 05 '23 01:12 yousoph

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.

rusackas avatar Apr 23 '24 23:04 rusackas