in src/Wmap/index.tsx [966:999]
export function convertPointPosition(ctx: Map, point: Types.LooseObject) {
if (point.x && point.y) {
return point;
}
if (!ctx.bgMapDataView) {
return point;
}
const { projection } = ctx;
if (point.lng && point.lat) {
return getProjectionPosition(point, ctx.bgMapDataView, projection, Number(point.lng), Number(point.lat));
}
if (point.name) {
let { name } = point;
if (!/^\w/.test(name)) {
if (/^\u963F\u62C9/.test(name) || /^\u5F20\u5BB6/.test(name)) {
// 阿拉、张家 两个开头的需要截取三个字符
name = name.slice(0, 3);
} else if (!/\u7701$/.test(name) && !/\u81ea\u6cbb\u533a$/.test(name)) {
// 以"省" / "自治区"结尾的不截断
name = name.slice(0, 2);
}
}
// @ts-ignore
const position = positionMap[name];
if (position) {
return getProjectionPosition(point, ctx.bgMapDataView, projection, position.lng, position.lat);
}
}
if (!point.x || !point.y) {
warn('Wmap', '无法定位地点', point);
}
return point;
}