diff --git a/src/components/app-header/index.tsx b/src/components/app-header/index.tsx index b113abf..7f516e6 100644 --- a/src/components/app-header/index.tsx +++ b/src/components/app-header/index.tsx @@ -294,7 +294,7 @@ export const AppHeader: React.FC = ({ toolbar }) => { { + onClick: ({ key }: any) => { onDownload(key); }, }} diff --git a/src/utils/gcoord.ts b/src/utils/gcoord.ts index e369824..7cd03db 100644 --- a/src/utils/gcoord.ts +++ b/src/utils/gcoord.ts @@ -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; +};