fix(util): geo convert

This commit is contained in:
thinkinggis 2019-03-14 15:58:54 +08:00
parent e9cb6a8eb5
commit 113aae900b
3 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import Base from './base';
import Controller from './controller/index';
import { getTransform, getParser } from '../source';
import { extent } from '../util/geo';
import { extent, tranfrormCoord } from '../util/geo';
import { getMap } from '../map/index';
export default class Source extends Base {
getDefaultCfg() {
@ -47,7 +47,8 @@ export default class Source extends Base {
}
_projectCoords() {
this.data.dataArray.forEach(data => {
data.coordinates = this._coordProject(data.coordinates);
// data.coordinates = this._coordProject(data.coordinates);
data.coordinates = tranfrormCoord(data.coordinates, this._coorConvert.bind(this));
});
}
createScale(field) {

View File

@ -57,7 +57,7 @@ export default class HeatMapLayer extends Layer {
}
afterRender() {
if (this.shapeType !== 'grid' || this.shapeType !== 'hexagon') {
if (this.shapeType !== 'grid' && this.shapeType !== 'hexagon') {
updateIntensityPass(this);
}
}

View File

@ -24,3 +24,16 @@ function calcExtent(extent, coords) {
}
return extent;
}
export function tranfrormCoord(data, cb) {
return transform(data, cb);
}
function transform(item, cb) {
if (Array.isArray(item[0])) {
return item.map(coord => {
return transform(coord, cb);
});
}
return cb(item);
}