如何基于mapbox的缩放设置clusterMaxZoom?

时间:2019-06-24 21:13:12

标签: javascript mapbox

我要根据缩放比例设置clusterMaxZoom值。

因此,在非常高的变焦下,我有一些设置,然后从某个时候开始,我有其他设置。

我认为可以使用表达式来完成,但是在示例中,它们更改了circleRadius的属性:

USE testing;
GO

--Change the data to the ISO yyyyMMdd format
UPDATE dbo.testing
SET HireDate = CONVERT(varchar(8),CONVERT(date,STUFF(STUFF(SeparationDate,5,0,'/'),3,0,'/'),101),112),
    SeparationDate = CONVERT(varchar(8),CONVERT(date,STUFF(STUFF(SeparationDate,5,0,'/'),3,0,'/'),101),112);
GO

--Change the data types
ALTER TABLE dbo.testing ALTER COLUMN HireDate date;
ALTER TABLE dbo.testing ALTER COLUMN SeparationDate date;
GO

--And now you can select, and change the datatype to a format, with ease
SELECT [EmployeeTC_No] AS [Employee TC#],
       [pye_nlast] AS [Name Last],
       [pye_nfirst] AS [Name First],
       [Dept] AS [Department],
       [pye_status] AS [Active],
       CONVERT(varchar(10),[HireDate],101) AS [Hire Date],
       CONVERT(varchar(10),[SeparationDate],101) AS [Separation Date]
  FROM [testing].[dbo].[testing];

});

所以我尝试这样做:

在缩放5时,将clusterMaxZoom设置为25 在缩放13时,将clusterMaxZoom设置为250

赞:

paint: {
  'circle-radius': [
    'interpolate', ['linear'], ['zoom'],
    10, ['/', ['-', 2017, ['number', ['get', 'Constructi'], 2017]], 30],
    13, ['/', ['-', 2017, ['number', ['get', 'Constructi'], 2017]], 10],
  ],
  'circle-opacity': 0.8,
  'circle-color': 'rgb(171, 72, 33)'
}

这是我的原始照片上的样子:

    clusterMaxZoom: [
      'interpolate', ['linear'], ['zoom'],
    5, 25,
    13, 250,
    ],

但是它不起作用,我得到这个错误:

map.addSource('users', { type: "geojson", // Point to GeoJSON data. This example visualizes all M1.0+ users // from 12/22/15 to 1/21/16 as logged by USGS' Earthquake hazards program. data: markers, cluster: true, // clusterMaxZoom: 22, // Max zoom to cluster points on clusterMaxZoom: [ 'interpolate', ['linear'], ['zoom'], 5, 25, 13, 250, ], clusterRadius: 250 // Radius of each cluster when clustering points (defaults to 50) });

有什么想法要基于缩放来更改clusterMaxZoom吗?

0 个答案:

没有答案