foursquare / fsq-studio-sdk-examples

Foursquare Studio is a platform to visualize, unify, enrich, and analyze spatial data on a planetary scale.
https://studio.foursquare.com
MIT License
21 stars 13 forks source link

replaceDataset method centers map #59

Closed IpIvanov closed 11 months ago

IpIvanov commented 1 year ago

I am using replaceDataset for one layer based on onLayerTimelineUpdate on some other layer.

In this case, mapView is centered based on the replaced dataset.

How I can prevent that centering?

map.eventHandlers.onLayerTimelineUpdate = event => {
      const roundedTimeInSeconds = Math.round(event.currentTime * 0.001);
      if (map_traffic_lights.has(roundedTimeInSeconds)) {
        // console.log(map_traffic_lights.get(event.currentTime * 0.001));
        // const view = map.getView();
        const dataLights = {
          id: 'test-dataset-03',
          label: 'Lights',
          data: map_traffic_lights.get(roundedTimeInSeconds)
        };
        map.replaceDataset('test-dataset-03', dataLights);
        // map.setView(view);
      }
    };
abstractalgo commented 1 year ago

Thanks for reporting this; unfortunately, this behavior is not possible to prevent right now. We did capture this as a work item and will let know once it's available.

IpIvanov commented 11 months ago

I've managed to accomplished product flow without replacing the dataset.