Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polygon显示变形严重 #2657

Open
flyours opened this issue Jan 7, 2025 · 7 comments
Open

polygon显示变形严重 #2657

flyours opened this issue Jan 7, 2025 · 7 comments
Assignees

Comments

@flyours
Copy link

flyours commented Jan 7, 2025

问题描述

方型的polgon显示成了梯形
image

重现链接

https://codesandbox.io/p/sandbox/l7-demo-forked-fntqmt?workspaceId=ws_SquWjKnX9ZtaqtASempSjf

重现步骤

import { Scene, LineLayer, RasterLayer, PolygonLayer } from "@antv/l7";
import { Map } from "@antv/l7-maps";

function initMap() {
const scene = new Scene({
id: "map",
map: new Map({
zoom: 10,
minZoom: 5,
maxZoom: 20,
}),
});
scene.on("loaded", () => {
const layer0 = new RasterLayer();
layer0.source(
"https://webrd0{1-3}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
minZoom: 2,
maxZoom: 18,
},
}
);
scene.addLayer(layer0);

const mydata = {
  type: "FeatureCollection",
  features: [
    {
      type: "Feature",
      id: "01",
      properties: {
        name: "Alabama",
        density: 94.65,
      },
      geometry: {
        type: "Polygon",
        coordinates: [
          [
            [116.47835134, 40.00333684],
            [116.47835333, 40.00330714],
            [116.4783333, 40.00330639],
            [116.47833131, 40.0033359],
            [116.47835134, 40.00333684],
          ],
        ],
      },
    },
  ],
};
const layer = new PolygonLayer({})
  .source(mydata)
  .color("#2ca02c")
  .shape("fill")
  .size(1)
  .style({
    opacity: 0.5,
  })
  .active(true);
const layer2 = new LineLayer({
  zIndex: 2,
})
  .source(mydata)
  .color("#2ca02c")
  .active(true)
  .size(1)
  .style({
    opacity: 1, // 设置线的透明度
  });
scene.addLayer(layer);
scene.addLayer(layer2);
layer.fitBounds();

});
}
initMap();

预期行为

应该是方型
image

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@flyours
Copy link
Author

flyours commented Jan 14, 2025

@lvisei 有时间能帮忙看看么? 多谢

@lvisei
Copy link
Member

lvisei commented Jan 17, 2025

这个矩形数据是什么坐标系,用的什么生成的。

{
      type: "FeatureCollection",
      features: [
        {
          type: "Feature",
          id: "01",
          properties: {
            name: "Alabama",
            density: 94.65,
          },
          geometry: {
            type: "Polygon",
            coordinates: [
              [
                [116.47835333, 40.0033359],
                [116.47835333, 40.00330714],
                [116.4783333, 40.00330714],
                [116.4783333, 40.0033359],
                [116.47835333, 40.0033359],
              ],
            ],
          },
        },
      ],
    }

Image

@flyours
Copy link
Author

flyours commented Jan 20, 2025

没有显示指定坐标系,这个需要如何制定坐标系么? 你这边是如何显示正常的? 多谢 @lvisei

@flyours
Copy link
Author

flyours commented Jan 20, 2025

我试了下官方示例,使用这个polygon还是不行,需要做什么设置么?

Image

@lvisei
Copy link
Member

lvisei commented Jan 20, 2025

只支持 EPSG4326,这数据层级很高了,不知道是不是数据精度丢失,可以在 QGIS 验证一下这个数据

@flyours flyours closed this as completed Jan 20, 2025
@flyours flyours reopened this Jan 20, 2025
@flyours
Copy link
Author

flyours commented Jan 21, 2025

这个数据 在geojson.io上显示是正常的矩形, 应该不是精度的问题,这个是不是和坐标系设置有关系? 多谢 @lvisei
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 116.47835134, 40.00333684 ], [ 116.47835333, 40.00330714 ], [ 116.4783333, 40.00330639 ], [ 116.47833131, 40.0033359 ], [ 116.47835134, 40.00333684 ] ] ] }, "id": 0 } ] }

Image

@flyours
Copy link
Author

flyours commented Jan 22, 2025

只支持 EPSG4326,这数据层级很高了,不知道是不是数据精度丢失,可以在 QGIS 验证一下这个数据

QGIS 4326显示也是矩形, @lvisei

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants