superset icon indicating copy to clipboard operation
superset copied to clipboard

Cannot set default latitude/longitude in MapBox chart

Open frafra opened this issue 3 years ago • 14 comments

How to reproduce the bug

  1. Create a new Chart
  2. Select MapBox
  3. Select latitude and longitude
  4. Click on Customize
  5. Zoom and pan on the map

Expected results

Change viewport default parameter.

Actual results

Latitude and longitude do not change, while the zoom parameter is glitchy.

Environment

  • browser type and version: Firefox 93
  • superset version: superset version the latest Superset from Docker

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • [X] 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.

frafra avatar Oct 28 '21 15:10 frafra

Hi @frafra what would help here is a screenshot or video of the issue. Without this, it's going to be quite hard for anyone here to help out.

srinify avatar Dec 12 '21 02:12 srinify

@srinify it looked easy to reproduce to me (just try to set a different latitude on a map, nothing happens), but I will send a video as requested.

frafra avatar Dec 13 '21 10:12 frafra

https://user-images.githubusercontent.com/4068/145795379-33d47264-6afd-4e2f-b847-13abde9651a6.mp4

As you can see, panning does not change latitude/longitude. Writing custom coordinates does not have any effect, even if the widget is saved and reloaded. The zoom glitches when zooming in.

frafra avatar Dec 13 '21 10:12 frafra

Can confirmed as well, Docker Superset 1.3.0

beersweetpicklepanda avatar Dec 16 '21 08:12 beersweetpicklepanda

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

stale[bot] avatar Apr 17 '22 20:04 stale[bot]

Still valid.

frafra avatar Apr 17 '22 22:04 frafra

still an issue

mike-fischer1 avatar Nov 08 '22 09:11 mike-fischer1

any updates?

mike-fischer1 avatar Nov 15 '22 22:11 mike-fischer1

I can reproduce it as well

JakobMiksch avatar Nov 23 '22 10:11 JakobMiksch

The problem seems to be here:

https://github.com/apache/superset/blob/a77b2d6ebfbe8caf98b2c0d00a19f3f744f18b2b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/transformProps.js#L88-L92

only the last call of setControlValue seems to be executed, the other calls are getting lost

JakobMiksch avatar Nov 23 '22 11:11 JakobMiksch

There seems to be a similar issue with the Deck.GL plugin. The popover of the Viewport-control does not properly update either. image

JakobMiksch avatar Nov 23 '22 11:11 JakobMiksch

Yep this is an issue in Deck.Gl as well. Would be nice to be able to set the default view.

JohnDietrich-Pepper avatar Aug 15 '23 06:08 JohnDietrich-Pepper

The lat/long/zoom values are not being used as the initial set of values when the component loads. Instead the bounds are used to calculate the viewport. I've added a control setting to switch from this behavior "Auto" to using "Fixed" values based on the lat/long/zoom in the viewport settings. image

I was also thinking that the setControlValue call should be saving the viewport settings when the map is dragged, so I thought an additional settings called "User" would be good to remember the User's dragged lat/long/zoom. However, it wasn't quite working as I expected and didn't seem to update the viewport settings properly.

I also noticed that on first load after login, the plots show up ok on the map, but if you click to another dashboard and then back again, the plots do not show up until you drag the map. This was due to clusters not being tracked in react state. I updated the component to an FC and fixed this issue by add clusters to useState.

There's still one more issue when looking at the world map and scanning left or right. When a plot disappears out of screen and then the same location shows up on the other side of the screen, the plot does not appear as soon as the location is visible.

Here is the map I'm expecting: image

After dragging to the left: image

Looks like the plot calculation needs to be updated to fix this issue. Possibly to create duplicate plots so if the location is visible twice on the map, the plot shows up twice. This can happen when zooming all the way out.

jseparovic avatar Jan 22 '24 22:01 jseparovic

I assume folks are still facing this... code reviews on the linked PR are more than welcome :)

rusackas avatar May 13 '24 20:05 rusackas