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

maptalks.three.min.js?e654:1 coordinate type is error,it should be Coordinate #128

Closed
lovsw opened this issue Mar 16, 2020 · 8 comments
Closed

Comments

@lovsw
Copy link

lovsw commented Mar 16, 2020

vue集成maptalks.three.js,当鼠标在地图上划过时,后台会报错,coordinate type is error,it should be Coordinate
image

@Liquid-Zhangliquan
Copy link

一般这个问题,说明是你数据问题。你可以再检查下你的数据,有没存在字符串或者coordinate为空的情况

@deyihu
Copy link
Collaborator

deyihu commented Mar 17, 2020

可以把代码贴下吗?内部layer identify 应该不会有这个问题,是不是自己自定义了identify 方法

@lovsw
Copy link
Author

lovsw commented Mar 17, 2020

image
这个是后台报错的截图。

@lovsw
Copy link
Author

lovsw commented Mar 17, 2020

` mounted: function(){

//实例化地图对象
let map = new maptalks.Map("map",{
center: [13.416935229170008, 52.529564137540376],
zoom: 20,
dragPitch : true,
//allow map to drag rotating, true by default
dragRotate : true,
//enable map to drag pitching and rotating at the same time, false by default
dragRotatePitch : true,
baseLayer: new maptalks.TileLayer('base', {
urlTemplate: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
subdomains: ['a','b','c','d'],
attribution: '© OpenStreetMap contributors, © CARTO'
})
});

// features to draw
//将Buildings中的数据,添加到features中
let features = [];

buildings.forEach(function (b) {
  console.log(b.features);
  features = features.concat(b.features);
});

// the ThreeLayer to draw buildings
let threeLayer = new ThreeLayer('t', {
forceRenderOnMoving : true,
forceRenderOnRotating : true
});

threeLayer.prepareToDraw = function (gl, scene, camera) {

  let me = this;
  let light = new THREE.DirectionalLight(0xffffff);
  light.position.set(0, -10, 10).normalize();
  scene.add(light);

  features.forEach(function (g) {
    let heightPerLevel = 5;
    let levels = g.properties.levels || 1;
    let color = 0x2685a7

    let m = new THREE.MeshPhongMaterial({color: color, opacity : 0.7});
    //change to back side with THREE <= v0.94
    // m.side = THREE.BackSide;

    let mesh = me.toExtrudeMesh(maptalks.GeoJSON.toGeometry(g), heightPerLevel, m,  heightPerLevel);
    if (Array.isArray(mesh)) {
      scene.add.apply(scene, mesh);
    } else {
      scene.add(mesh);
    }
  });
};

threeLayer.addTo(map);`

@lovsw
Copy link
Author

lovsw commented Mar 17, 2020

其中的Buildings.js是官方例子提供的

@deyihu
Copy link
Collaborator

deyihu commented Mar 17, 2020

@lovsw 237726126 这个是群号进来问

@deyihu
Copy link
Collaborator

deyihu commented Mar 18, 2020

The problem has been solved. It may be a bug in webpack

@deyihu deyihu closed this as completed Mar 18, 2020
@deyihu
Copy link
Collaborator

deyihu commented Jul 7, 2021

more detail #299

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

3 participants