antvis / L7

🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis engine.
https://l7.antv.antgroup.com
MIT License
3.67k stars 636 forks source link

绘制圆数据在缩放小于等于 11 时渲染变形 #2590

Open lvisei opened 3 months ago

lvisei commented 3 months ago

问题描述

绘制圆数据在缩放小于等于 11 时,渲染成椭圆

image

重现链接

No response

重现步骤

import { LineLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';

const scene = new Scene({
  id: 'map',
  map: new GaodeMap({
    style: 'light',
    zoom: 3,
  }),
});
scene.on('loaded', () => {
  const layer = new LineLayer({ autoFit: true })
    .source({
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {},
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                [116.511132, 39.870292],
                [116.511668, 39.870271],
                [116.512198, 39.870206],
                [116.512716, 39.8701],
                [116.513217, 39.869952],
                [116.513696, 39.869765],
                [116.514146, 39.869541],
                [116.514563, 39.869281],
                [116.514942, 39.86899],
                [116.51528, 39.86867],
                [116.515572, 39.868325],
                [116.515816, 39.867958],
                [116.516008, 39.867573],
                [116.516147, 39.867175],
                [116.516231, 39.866768],
                [116.516259, 39.866357],
                [116.516231, 39.865946],
                [116.516147, 39.865539],
                [116.516008, 39.865141],
                [116.515816, 39.864756],
                [116.515572, 39.864389],
                [116.51528, 39.864044],
                [116.514942, 39.863724],
                [116.514563, 39.863433],
                [116.514145, 39.863173],
                [116.513695, 39.862949],
                [116.513217, 39.862762],
                [116.512716, 39.862614],
                [116.512198, 39.862508],
                [116.511668, 39.862443],
                [116.511132, 39.862422],
                [116.510596, 39.862443],
                [116.510066, 39.862508],
                [116.509548, 39.862614],
                [116.509047, 39.862762],
                [116.508569, 39.862949],
                [116.508119, 39.863173],
                [116.507701, 39.863433],
                [116.507322, 39.863724],
                [116.506984, 39.864044],
                [116.506692, 39.864389],
                [116.506448, 39.864756],
                [116.506256, 39.865141],
                [116.506117, 39.865539],
                [116.506033, 39.865946],
                [116.506005, 39.866357],
                [116.506033, 39.866768],
                [116.506117, 39.867175],
                [116.506256, 39.867573],
                [116.506448, 39.867958],
                [116.506692, 39.868325],
                [116.506984, 39.86867],
                [116.507322, 39.86899],
                [116.507701, 39.869281],
                [116.508118, 39.869541],
                [116.508568, 39.869765],
                [116.509047, 39.869952],
                [116.509548, 39.8701],
                [116.510066, 39.870206],
                [116.510596, 39.870271],
                [116.511132, 39.870292]
              ]
            ]
          }
        }
      ]
    })
    .color('red');
  scene.addLayer(layer);

});

预期行为

No response

平台

No response

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

TaoHuaXia commented 3 months ago

相同的其他类型的图形在这个情况也会出现问题,比如绘制的正方形,在缩放小于等于11的时候会变成矩形等等

lvisei commented 3 months ago

相同的其他类型的图形在这个情况也会出现问题,比如绘制的正方形,在缩放小于等于11的时候会变成矩形等等

提供一个数据~

TaoHuaXia commented 3 months ago

相同的其他类型的图形在这个情况也会出现问题,比如绘制的正方形,在缩放小于等于11的时候会变成矩形等等

提供一个数据~

@lvisei 请查收 1、昨天又发现在云南附近的一个纬度也会出现这个问题,应该是同样的问题,geo数据如下: {"type":"Polygon","coordinates":[[[103.816213,25.555918],[103.817811,25.555843],[103.819391,25.555617],[103.820936,25.555243],[103.82243,25.554726],[103.823855,25.554071],[103.825197,25.553284],[103.82644,25.552376],[103.827571,25.551355],[103.828578,25.550234],[103.829449,25.549023],[103.830175,25.547737],[103.830748,25.546389],[103.831162,25.544995],[103.831412,25.54357],[103.831496,25.542128],[103.831412,25.540687],[103.831162,25.539261],[103.830747,25.537867],[103.830174,25.53652],[103.829448,25.535234],[103.828576,25.534023],[103.827569,25.532902],[103.826438,25.531881],[103.825195,25.530973],[103.823854,25.530187],[103.822428,25.529532],[103.820935,25.529015],[103.81939,25.528641],[103.81781,25.528415],[103.816213,25.52834],[103.814616,25.528415],[103.813036,25.528641],[103.811491,25.529015],[103.809998,25.529532],[103.808572,25.530187],[103.807231,25.530973],[103.805988,25.531881],[103.804857,25.532902],[103.80385,25.534023],[103.802978,25.535234],[103.802252,25.53652],[103.801679,25.537867],[103.801264,25.539261],[103.801014,25.540687],[103.80093,25.542128],[103.801014,25.54357],[103.801264,25.544995],[103.801678,25.546389],[103.802251,25.547737],[103.802977,25.549023],[103.803848,25.550234],[103.804855,25.551355],[103.805986,25.552376],[103.807229,25.553284],[103.808571,25.554071],[103.809996,25.554726],[103.81149,25.555243],[103.813035,25.555617],[103.814615,25.555843],[103.816213,25.555918]]]}

2、补充的正方形的geo数据,在缩放小于等于11时明显变成矩形: {"type":"Polygon","coordinates":[[[103.843181,25.536484],[103.843181,25.544911],[103.852653,25.544911],[103.852653,25.536484],[103.843181,25.536484]]]}

3、同理,其他类型的图形也如此:

lvisei commented 3 months ago

排查下来大层级,数据精度丢失的原因,内部逻辑大于 12 使用了双精度偏移坐标,小于 12 层级出现数据绘制变形,具体看怎么优化这个逻辑。

https://github.com/antvis/L7/blob/master/packages/maps/src/lib/base-map.ts#L87-L92

image

TaoHuaXia commented 2 months ago

@lvisei 哈喽,大佬,打扰了。这个问题现在有什么临时的解决方案吗?还是需要等项目成员来修复这个BUG才可以?

lvisei commented 2 months ago

@lvisei 哈喽,大佬,打扰了。这个问题现在有什么临时的解决方案吗?还是需要等项目成员来修复这个BUG才可以?

目前还没有找到方案