Skip to content

Commit

Permalink
fix: 添加转换方法
Browse files Browse the repository at this point in the history
  • Loading branch information
syb01094648 committed Feb 20, 2024
1 parent 79e43a4 commit a3b2281
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/app-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const AppHeader: React.FC<AppHeaderProps> = ({ toolbar }) => {
<Dropdown
menu={{
items: DropdownMenuItems,
onClick: ({ key }) => {
onClick: ({ key }: any) => {
onDownload(key);
},
}}
Expand Down
32 changes: 32 additions & 0 deletions src/utils/gcoord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,35 @@ export const gcj02towgs84 = (feature: Feature) => {
// @ts-ignore
return gcoord.transform(feature, gcoord.GCJ02, gcoord.WGS84) as Feature;
};

export const gcj02tobd09 = (feature: Feature) => {
if (feature.geometry.type.match(/polygon/i)) {
feature.geometry = JSON.parse(JSON.stringify(feature.geometry));
}
// @ts-ignore
return gcoord.transform(feature, gcoord.GCJ02, gcoord.BD09) as Feature;
};

export const bd09togcj02 = (feature: Feature) => {
if (feature.geometry.type.match(/polygon/i)) {
feature.geometry = JSON.parse(JSON.stringify(feature.geometry));
}
// @ts-ignore
return gcoord.transform(feature, gcoord.BD09, gcoord.GCJ02) as Feature;
};

export const wgs84tobd09 = (feature: Feature) => {
if (feature.geometry.type.match(/polygon/i)) {
feature.geometry = JSON.parse(JSON.stringify(feature.geometry));
}
// @ts-ignore
return gcoord.transform(feature, gcoord.WGS84, gcoord.BD09) as Feature;
};

export const bd09towgs84 = (feature: Feature) => {
if (feature.geometry.type.match(/polygon/i)) {
feature.geometry = JSON.parse(JSON.stringify(feature.geometry));
}
// @ts-ignore
return gcoord.transform(feature, gcoord.BD09, gcoord.WGS84) as Feature;
};

0 comments on commit a3b2281

Please sign in to comment.