diff --git a/packages/layers/src/plugins/DataMappingPlugin.ts b/packages/layers/src/plugins/DataMappingPlugin.ts index 39f38825d7..4257024b82 100644 --- a/packages/layers/src/plugins/DataMappingPlugin.ts +++ b/packages/layers/src/plugins/DataMappingPlugin.ts @@ -221,8 +221,9 @@ this.adjustData2MapboxCoordinates(mappedData); this.mapService.version === Version['MAPBOX'] ) { mappedData.map((d) => { + d.version = Version['MAPBOX']; // @ts-ignore - d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据) + d.originCoordinates = cloneDeep(d.coordinates); // @ts-ignore d.coordinates = this.getMapboxCoordiantes(d.coordinates); }); diff --git a/packages/layers/src/point/models/text.ts b/packages/layers/src/point/models/text.ts index c1822859cd..fccdddf009 100644 --- a/packages/layers/src/point/models/text.ts +++ b/packages/layers/src/point/models/text.ts @@ -424,7 +424,7 @@ export default class TextModel extends BaseModel { // 此时地图高德2.0 originCentroid == centroid feature.originCentroid = - feature.version === 'GAODE2.x' + (feature.version === 'GAODE2.x' || feature.version === 'MAPBOX') ? calculateCentroid(feature.originCoordinates) : (feature.originCentroid = feature.centroid); @@ -470,7 +470,7 @@ export default class TextModel extends BaseModel { // const centroid = feature.centroid as [number, number]; // const centroid = feature.originCentroid as [number, number]; const centroid = ( - feature.version === 'GAODE2.x' + (feature.version === 'GAODE2.x' || feature.version === 'MAPBOX') ? feature.originCentroid : feature.centroid ) as [number, number];