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

PloyPoint问题 #590

Closed
treasureMoment opened this issue Jan 12, 2018 · 9 comments
Closed

PloyPoint问题 #590

treasureMoment opened this issue Jan 12, 2018 · 9 comments

Comments

@treasureMoment
Copy link
Contributor

maptalks's version and what browser you use?

image
这个是使用maptalks.js绘制完成显示的多边形
image
这个是使用openlayer绘制完成显示的多边形,
数据使用的是一份数据
还有,咱们的 maptalks.js不支持移动端的手势旋转操作么��
Issue description

Please provide a reproduction URL (on any jsfiddle like site)

@fuzhenn
Copy link
Member

fuzhenn commented Jan 12, 2018

感谢提出issue!
关于第2个问题,目前maptalks���实还不支持移动端的手势操作,我刚提交了一个feature request issue,这个特性会在下个版本提供:#591

关于第1个问题,你是指maptalks绘制的有错误吗?方便的话请提供一下重现代码,只看图无法定位问题,可以在这个jsfiddle基础上修改:

http://jsfiddle.net/fuzhenn/8vxbqz22/

@treasureMoment
Copy link
Contributor Author

[[1509.01,336.83434,10],[1562.82,336.83434,10],[1562.82,341.54434000000003,10],[1731.42,341.54434000000003,10],[1738.57,349.49434,10],[1810.15,349.49434,10],[1817.04,340.74434,10],[1836.39,340.74434,10],[1836.39,351.88434,10],[1902.66,351.88434,10],[1902.66,337.30434,10],[2010.29,337.30434,10],[2069.67,337.30434,10],[2069.67,413.96434,10],[2069.4,463.57434,10],[2043.69,463.57434,10],[2043.69,468.78434000000004,10],[2069.93,468.78434000000004,10],[2069.93,538.23434,10],[2043.69,538.23434,10],[2043.69,543.80434,10],[2069.67,543.80434,10],[2069.67,544.86434,10],[2098.03,544.86434,10],[2098.03,517.29434,10],[2125.6,517.29434,10],[2125.6,512.52434,10],[2098.56,512.52434,10],[2098.56,444.66434000000004,10],[2125.6,444.66434000000004,10],[2125.6,439.35434,10],[2098.73,439.42434000000003,10],[2098.73,425.64434,10],[2098.63,370.09434,10],[2098.56,321.66434000000004,10],[2125.87,321.66434000000004,10],[2125.87,316.35434,10],[2098.3,316.35434,10],[2098.3,313.17434000000003,10],[1965.75,313.17434000000003,10],[1965.75,285.60434000000004,10],[1974.5,276.86434,10],[1965.22,267.84434,10],[1581.64,267.84434,10],[1572.63,277.12434,10],[1581.64,286.40434,10],[1581.64,308.67434000000003,10],[1572.37,308.67434000000003,10],[1565.21,317.68434,10],[1509.01,317.75434,10],[1509.01,336.83434,10]]
这个是使用的坐标数据,是使用
spatialReference:{
projection:'EPSG:4326'
},坐标系

@treasureMoment
Copy link
Contributor Author

treasureMoment commented Jan 12, 2018

var map = new maptalks.Map('map', {
  center: [1063, 273.59717],
  zoom: 1,
  spatialReference: {
    projection: 'EPSG:4326'
  },

});

var polygon = new maptalks.Polygon([
  [
    [1509.01, 336.83434, 10],
    [1562.82, 336.83434, 10],
    [1562.82, 341.54434000000003, 10],
    [1731.42, 341.54434000000003, 10],
    [1738.57, 349.49434, 10],
    [1810.15, 349.49434, 10],
    [1817.04, 340.74434, 10],
    [1836.39, 340.74434, 10],
    [1836.39, 351.88434, 10],
    [1902.66, 351.88434, 10],
    [1902.66, 337.30434, 10],
    [2010.29, 337.30434, 10],
    [2069.67, 337.30434, 10],
    [2069.67, 413.96434, 10],
    [2069.4, 463.57434, 10],
    [2043.69, 463.57434, 10],
    [2043.69, 468.78434000000004, 10],
    [2069.93, 468.78434000000004, 10],
    [2069.93, 538.23434, 10],
    [2043.69, 538.23434, 10],
    [2043.69, 543.80434, 10],
    [2069.67, 543.80434, 10],
    [2069.67, 544.86434, 10],
    [2098.03, 544.86434, 10],
    [2098.03, 517.29434, 10],
    [2125.6, 517.29434, 10],
    [2125.6, 512.52434, 10],
    [2098.56, 512.52434, 10],
    [2098.56, 444.66434000000004, 10],
    [2125.6, 444.66434000000004, 10],
    [2125.6, 439.35434, 10],
    [2098.73, 439.42434000000003, 10],
    [2098.73, 425.64434, 10],
    [2098.63, 370.09434, 10],
    [2098.56, 321.66434000000004, 10],
    [2125.87, 321.66434000000004, 10],
    [2125.87, 316.35434, 10],
    [2098.3, 316.35434, 10],
    [2098.3, 313.17434000000003, 10],
    [1965.75, 313.17434000000003, 10],
    [1965.75, 285.60434000000004, 10],
    [1974.5, 276.86434, 10],
    [1965.22, 267.84434, 10],
    [1581.64, 267.84434, 10],
    [1572.63, 277.12434, 10],
    [1581.64, 286.40434, 10],
    [1581.64, 308.67434000000003, 10],
    [1572.37, 308.67434000000003, 10],
    [1565.21, 317.68434, 10],
    [1509.01, 317.75434, 10],
    [1509.01, 336.83434, 10]
  ]
], {
  visible: true,
  editable: true,
  cursor: 'pointer',
  shadowBlur: 0,
  shadowColor: 'black',
  draggable: false,
  dragShadow: false, // display a shadow during dragging
  drawOnAxis: null, // force dragging stick on a axis, can be: x, y
  symbol: {
    'lineColor': '#34495e',
    'lineWidth': 2,
    'polygonFill': 'rgb(135,196,240)',
    'polygonOpacity': 0.6
  }
});
new maptalks.VectorLayer('vector', polygon).addTo(map);
@fuzhenn
Copy link
Member

fuzhenn commented Jan 12, 2018

收到。
我试了一下,这个问题不是bug,是map的spatialReference设置的问题。
看坐标,它并不是经纬度坐标,所以用EPSG:4326是无法正常显示的,这样初始化map就能正常显示了:

var map = new maptalks.Map('map', {
      center: [1509.01,336.83434],
      zoom: 1,
      spatialReference : {
        //改为基于像素坐标的identity投影
        projection : 'identity',
        //可以根据需要增加更多的resolution (缩放级别)
        resolutions : [
          2, 1, 0.5
        ],
        fullExtent : {
          top : 10000,
          bottom : -10000,
          left : -10000,
          right : 10000
        }
      }
    });
@fuzhenn fuzhenn closed this as completed Jan 12, 2018
@treasureMoment
Copy link
Contributor Author

OK.已经设置了。正常显示了。
需要使用平面坐标系, spatialReference : {
//改为基于像素坐标的identity投影
projection : 'identity}
只是这���设置。会报错= =~。leafelt openlayer 使用同样的坐标系 ,这样的轮廓点可以正常绘制

@treasureMoment
Copy link
Contributor Author

下个版本支持移动端手势的能规划么?什么时候能发版?

@fuzhenn
Copy link
Member

fuzhenn commented Jan 12, 2018

解决就好!

报错是因为spatialReference缺resolutions和fullExtent导致的。不过你提醒我了,应该给identity投影提供默认的设置。

maptalks 4326 不能正常显示应该是因为maptalks对anti-meridian的自动处理逻辑导致(如何处理线在地球球体上的两种绘制模式)。ol和leaflet没这个逻辑,所以绘制是正确的。原则上4326的输入应该还是经纬度。

手势应该在1到2周内会实现发布。

@treasureMoment
Copy link
Contributor Author

resolutions 应该根据minZoom和MaxZoom 以及每次的变化的步长提供默认值,每次更改最小和最大都应该做出相应的改变

@fuzhenn
Copy link
Member

fuzhenn commented Jan 15, 2018

已添加,参见:8aaf49f
下个版本会发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants