问题描述:
我在拖拽事件里获取拖拽元素所有的坐标,所以坐标的x,y输出出来后发现获取的有问题
x,y坐标输出结果:115.96681,37.51906,115.96548,37.51578,115.96653,37.51126,115.98208374910999,37.51517293772901,115.98257374910999,37.51332293772901,115.98540374910999,37.513182937729006,115.98505374911,37.51522293772901,115.98208374910999,37.51517293772901,43621168,54095232,43620512,54094416,43618568,54095144,43620328,54096728,43621944,54096040,43621184,54095224,43621168,54095232,43591224,54104008,43590496,54103488,43591072,54103112,43592840,54104280,43591504,54105152,43589736,54104056,43590488,54103496,43591224,54104008
像前面的字符串中115.98208374910999,37.51517293772901的是正确的数据,但是从中间某段开始变成了43621168,54095232。我发现坐标数据里面,前面的数据都是7位或者8位数,小数点后面是5位,从大约第4个坐标开始小数点位数变成14位了。
我使用的代码描述:
function onLayerControlDragCompleteEvent(feature,pixel){
var fea= feature;
var position = pixel;
console.log('onLayerControlDragCompleteEvent fea:'+ fea);
//console.log('onLayerControlDragCompleteEvent position:'+ position);
var layerfeatures = fea.layer['features'];
var giscorrd = [];
for(var i =0;i<layerfeatures.length;i++){
var components = layerfeatures[i]['geometry']['components'];
for(var j = 0;j<components.length;j++){
/* if(j>0){
giscorrd += ',';
}*/
//giscorrd += components[j].x+','+components[j].y;
giscorrd.push(components[j].x);
giscorrd.push(components[j].y);
}
}
console.log('giscorrd22233====='+giscorrd.join(','));
}
请帮忙看下这块,是哪里出现了问题,谢谢。