xy-map 1.1.12 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xy-map",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "雄越地图",
5
5
  "main": "xy-map.umd.min.js",
6
6
  "scripts": {
package/xy-map.common.js CHANGED
@@ -24404,7 +24404,7 @@ var style_map = __webpack_require__(7193);
24404
24404
  var defaultOptions = {
24405
24405
  container: 'map',
24406
24406
  zoom: 12,
24407
- // maxZoom: 18,
24407
+ maxZoom: 18,
24408
24408
  center: [102.485544, 24.921785],
24409
24409
  pitch: 0,
24410
24410
  // 3d倾斜视角
@@ -24438,9 +24438,10 @@ var defaultOptions = {
24438
24438
  'tiles': ['https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=pk.eyJ1IjoiaGo0NjI3NzEzOTYiLCJhIjoiY2w5YzNjOTZvMDF6NDNwb2d6YmJkYWRpMCJ9.-fW-OChGB1oY2DCMO_c8sg'
24439
24439
  // 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
24440
24440
  // 'https://map.ynmdgq.com/{z}/{x}/{y}.png'
24441
+ // 'http://t7.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=f3c2ca3a170f5712abd7b6858e038f18',
24441
24442
  ],
24442
24443
 
24443
- 'tileSize': 256
24444
+ 'tileSize': 512
24444
24445
  }
24445
24446
  },
24446
24447
  'layers': [{
@@ -24450,15 +24451,7 @@ var defaultOptions = {
24450
24451
  }]
24451
24452
  },
24452
24453
  defaultLanguage: 'zh',
24453
- // preserveDrawingBuffer: true, // 允许地图导出为图片
24454
- // sprite: 'mapbox://sprites/mapbox/bright-v8', //不受地图旋转缩放影响的图标等,类似精灵漂浮在空中,当有 layer 使用了 background-pattern、fill-pattern、line-pattern、fill-extrusion-pattern、icon-image 等属性时,sprite 必填。
24455
- // transition: { //全局的过渡动画属性
24456
- // duration: 300, // 过渡的持续时间(可选,单位:毫秒,默认值为 300)
24457
- // delay: 0 // 延迟多久开始过渡(可选,单位:毫秒,默认值为 0)
24458
- // },
24459
24454
  is3d: true // 3d视图
24460
- // glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf'
24461
- // style: 'mapbox://styles/mapbox/streets-v9',
24462
24455
  };
24463
24456
 
24464
24457
 
@@ -24586,14 +24579,14 @@ class mapSdk {
24586
24579
  let map = this.map;
24587
24580
  if (night || this.options.night) {
24588
24581
  // 晚上
24589
- // map.setFog({
24590
- // 'range': [1, 15],
24591
- // 'horizon-blend': 0.1,
24592
- // 'color': '#242B4B',
24593
- // 'high-color': '#161B36',
24594
- // 'space-color': '#0B1026',
24595
- // 'star-intensity': 0.1
24596
- // })
24582
+ map.setFog({
24583
+ 'range': [1, 15],
24584
+ 'horizon-blend': 0.1,
24585
+ 'color': '#242B4B',
24586
+ 'high-color': '#161B36',
24587
+ 'space-color': '#0B1026',
24588
+ 'star-intensity': 0.1
24589
+ });
24597
24590
  } else {
24598
24591
  // 天空
24599
24592
  map.addLayer({
@@ -48500,7 +48493,7 @@ const addLayerPoint = (option, layerId) => {
48500
48493
  }, layerId);
48501
48494
  if (opt.cluster.cluster) {
48502
48495
  let style = opt.cluster.style || {};
48503
- clusterLayer(id, style);
48496
+ clusterLayer(opt, style);
48504
48497
  }
48505
48498
  if (opt.click) {
48506
48499
  mapClick(id, opt.click);
@@ -48591,7 +48584,7 @@ const addDiyPoint = (option, layerId) => {
48591
48584
  }, layerId);
48592
48585
  if (opt.cluster.cluster) {
48593
48586
  let style = opt.cluster.style || {};
48594
- clusterLayer(id, style);
48587
+ clusterLayer(opt, style);
48595
48588
  }
48596
48589
  if (opt.click) {
48597
48590
  mapClick(id, opt.click);
@@ -48688,7 +48681,7 @@ const addLayerImagePoint = async (option, layerId) => {
48688
48681
  }
48689
48682
  if (opt.cluster.cluster) {
48690
48683
  let style = opt.cluster.style || {};
48691
- clusterLayer(id, style);
48684
+ clusterLayer(opt, style);
48692
48685
  }
48693
48686
  if (opt.click) {
48694
48687
  mapClick(id, opt.click);
@@ -48733,10 +48726,6 @@ const clusterLayer = (option, style) => {
48733
48726
  map
48734
48727
  } = package_map;
48735
48728
  let id = option.id;
48736
- if (hasLayer(id)) {
48737
- setSource(id, option.data);
48738
- return;
48739
- }
48740
48729
  let layout = style ? style.layout : {};
48741
48730
  let layoutOpt = Object.assign({
48742
48731
  'text-field': '{point_count_abbreviated}',
@@ -48745,8 +48734,10 @@ const clusterLayer = (option, style) => {
48745
48734
  }, layout);
48746
48735
  let paint = style ? style.paint : {};
48747
48736
  let paintOpt = Object.assign({
48748
- 'circle-color': ['step', ['get', 'point_count'], '#51bbd6', 100, '#f1f075', 350, '#f28cb1'],
48749
- 'circle-radius': ['step', ['get', 'point_count'], 20, 100, 30, 750, 40]
48737
+ 'circle-color': ['step', ['get', 'point_count'], 'rgba(110, 204, 57, 0.7)', 20, 'rgba(240, 194, 12, 0.7)', 50, 'rgba(241, 128, 23, 0.7)', 100, 'rgba(241, 23, 23, 0.7)'],
48738
+ 'circle-stroke-color': ['step', ['get', 'point_count'], 'rgba(110, 204, 57, 0.3)', 20, 'rgba(240, 194, 12, 0.3)', 50, 'rgba(241, 128, 23, 0.3)', 100, 'rgba(241, 23, 23, 0.3)'],
48739
+ 'circle-stroke-width': ['step', ['get', 'point_count'], 5, 20, 6, 50, 7, 100, 7],
48740
+ 'circle-radius': ['step', ['get', 'point_count'], 16, 20, 18, 50, 20, 100, 21]
48750
48741
  }, paint);
48751
48742
  map.addLayer({
48752
48743
  id: id + '-clusters',
@@ -48760,9 +48751,12 @@ const clusterLayer = (option, style) => {
48760
48751
  type: 'symbol',
48761
48752
  source: option.id,
48762
48753
  filter: ['has', 'point_count'],
48763
- layout: layoutOpt
48754
+ layout: layoutOpt,
48755
+ paint: {
48756
+ 'text-color': '#ffffff'
48757
+ }
48764
48758
  });
48765
- mapClick(id + 'clusters', e => {
48759
+ mapClick(id + '-clusters', e => {
48766
48760
  package_map.zoom('in', e.position);
48767
48761
  });
48768
48762
  };
package/xy-map.umd.js CHANGED
@@ -24422,7 +24422,7 @@ var style_map = __webpack_require__(4321);
24422
24422
  var defaultOptions = {
24423
24423
  container: 'map',
24424
24424
  zoom: 12,
24425
- // maxZoom: 18,
24425
+ maxZoom: 18,
24426
24426
  center: [102.485544, 24.921785],
24427
24427
  pitch: 0,
24428
24428
  // 3d倾斜视角
@@ -24456,9 +24456,10 @@ var defaultOptions = {
24456
24456
  'tiles': ['https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=pk.eyJ1IjoiaGo0NjI3NzEzOTYiLCJhIjoiY2w5YzNjOTZvMDF6NDNwb2d6YmJkYWRpMCJ9.-fW-OChGB1oY2DCMO_c8sg'
24457
24457
  // 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
24458
24458
  // 'https://map.ynmdgq.com/{z}/{x}/{y}.png'
24459
+ // 'http://t7.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=f3c2ca3a170f5712abd7b6858e038f18',
24459
24460
  ],
24460
24461
 
24461
- 'tileSize': 256
24462
+ 'tileSize': 512
24462
24463
  }
24463
24464
  },
24464
24465
  'layers': [{
@@ -24468,15 +24469,7 @@ var defaultOptions = {
24468
24469
  }]
24469
24470
  },
24470
24471
  defaultLanguage: 'zh',
24471
- // preserveDrawingBuffer: true, // 允许地图导出为图片
24472
- // sprite: 'mapbox://sprites/mapbox/bright-v8', //不受地图旋转缩放影响的图标等,类似精灵漂浮在空中,当有 layer 使用了 background-pattern、fill-pattern、line-pattern、fill-extrusion-pattern、icon-image 等属性时,sprite 必填。
24473
- // transition: { //全局的过渡动画属性
24474
- // duration: 300, // 过渡的持续时间(可选,单位:毫秒,默认值为 300)
24475
- // delay: 0 // 延迟多久开始过渡(可选,单位:毫秒,默认值为 0)
24476
- // },
24477
24472
  is3d: true // 3d视图
24478
- // glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf'
24479
- // style: 'mapbox://styles/mapbox/streets-v9',
24480
24473
  };
24481
24474
 
24482
24475
 
@@ -24604,14 +24597,14 @@ class mapSdk {
24604
24597
  let map = this.map;
24605
24598
  if (night || this.options.night) {
24606
24599
  // 晚上
24607
- // map.setFog({
24608
- // 'range': [1, 15],
24609
- // 'horizon-blend': 0.1,
24610
- // 'color': '#242B4B',
24611
- // 'high-color': '#161B36',
24612
- // 'space-color': '#0B1026',
24613
- // 'star-intensity': 0.1
24614
- // })
24600
+ map.setFog({
24601
+ 'range': [1, 15],
24602
+ 'horizon-blend': 0.1,
24603
+ 'color': '#242B4B',
24604
+ 'high-color': '#161B36',
24605
+ 'space-color': '#0B1026',
24606
+ 'star-intensity': 0.1
24607
+ });
24615
24608
  } else {
24616
24609
  // 天空
24617
24610
  map.addLayer({
@@ -48518,7 +48511,7 @@ const addLayerPoint = (option, layerId) => {
48518
48511
  }, layerId);
48519
48512
  if (opt.cluster.cluster) {
48520
48513
  let style = opt.cluster.style || {};
48521
- clusterLayer(id, style);
48514
+ clusterLayer(opt, style);
48522
48515
  }
48523
48516
  if (opt.click) {
48524
48517
  mapClick(id, opt.click);
@@ -48609,7 +48602,7 @@ const addDiyPoint = (option, layerId) => {
48609
48602
  }, layerId);
48610
48603
  if (opt.cluster.cluster) {
48611
48604
  let style = opt.cluster.style || {};
48612
- clusterLayer(id, style);
48605
+ clusterLayer(opt, style);
48613
48606
  }
48614
48607
  if (opt.click) {
48615
48608
  mapClick(id, opt.click);
@@ -48706,7 +48699,7 @@ const addLayerImagePoint = async (option, layerId) => {
48706
48699
  }
48707
48700
  if (opt.cluster.cluster) {
48708
48701
  let style = opt.cluster.style || {};
48709
- clusterLayer(id, style);
48702
+ clusterLayer(opt, style);
48710
48703
  }
48711
48704
  if (opt.click) {
48712
48705
  mapClick(id, opt.click);
@@ -48751,10 +48744,6 @@ const clusterLayer = (option, style) => {
48751
48744
  map
48752
48745
  } = package_map;
48753
48746
  let id = option.id;
48754
- if (hasLayer(id)) {
48755
- setSource(id, option.data);
48756
- return;
48757
- }
48758
48747
  let layout = style ? style.layout : {};
48759
48748
  let layoutOpt = Object.assign({
48760
48749
  'text-field': '{point_count_abbreviated}',
@@ -48763,8 +48752,10 @@ const clusterLayer = (option, style) => {
48763
48752
  }, layout);
48764
48753
  let paint = style ? style.paint : {};
48765
48754
  let paintOpt = Object.assign({
48766
- 'circle-color': ['step', ['get', 'point_count'], '#51bbd6', 100, '#f1f075', 350, '#f28cb1'],
48767
- 'circle-radius': ['step', ['get', 'point_count'], 20, 100, 30, 750, 40]
48755
+ 'circle-color': ['step', ['get', 'point_count'], 'rgba(110, 204, 57, 0.7)', 20, 'rgba(240, 194, 12, 0.7)', 50, 'rgba(241, 128, 23, 0.7)', 100, 'rgba(241, 23, 23, 0.7)'],
48756
+ 'circle-stroke-color': ['step', ['get', 'point_count'], 'rgba(110, 204, 57, 0.3)', 20, 'rgba(240, 194, 12, 0.3)', 50, 'rgba(241, 128, 23, 0.3)', 100, 'rgba(241, 23, 23, 0.3)'],
48757
+ 'circle-stroke-width': ['step', ['get', 'point_count'], 5, 20, 6, 50, 7, 100, 7],
48758
+ 'circle-radius': ['step', ['get', 'point_count'], 16, 20, 18, 50, 20, 100, 21]
48768
48759
  }, paint);
48769
48760
  map.addLayer({
48770
48761
  id: id + '-clusters',
@@ -48778,9 +48769,12 @@ const clusterLayer = (option, style) => {
48778
48769
  type: 'symbol',
48779
48770
  source: option.id,
48780
48771
  filter: ['has', 'point_count'],
48781
- layout: layoutOpt
48772
+ layout: layoutOpt,
48773
+ paint: {
48774
+ 'text-color': '#ffffff'
48775
+ }
48782
48776
  });
48783
- mapClick(id + 'clusters', e => {
48777
+ mapClick(id + '-clusters', e => {
48784
48778
  package_map.zoom('in', e.position);
48785
48779
  });
48786
48780
  };