Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 补充已导出的辅助函数的相关文档 #42

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/helpers/stories/amapPolygonPath2GeoJSONCoords.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Meta } from "@storybook/blocks";

<Meta title="Helpers/amapPolygonPath2GeoJSONCoords" />

# amapPolygonPath2GeoJSONCoords

将 `AMap.Polygon` 的 `path` 数据转换成 `GeoJSON.Polygon` 的 coords。

由于 `AMap.Polygon` 的 `path` 允许最后一个点与起始点不需要一致,这不符合 `GeoJSON` 规范中对 `RingLine` 的定义。
因此在实际使用时需要进行数据转换。

类型声明:

```ts
const amapPolygonPath2GeoJSONCoords: (
path: ReturnType<AMap.Polygon['getPath']>
) => GeoJSON.Position[] | GeoJSON.Position[][] | GeoJSON.Position[][][]
```
18 changes: 18 additions & 0 deletions src/helpers/stories/coordsOfGeoJSON2AMapPolygonPath.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Meta } from "@storybook/blocks";

<Meta title="Helpers/coordsOfGeoJSON2AMapPolygonPath" />

# coordsOfGeoJSON2AMapPolygonPath

将 `GeoJSON.Polygon` 的 `coords` 转换成 `AMap.Polygon` 的 `path` 需要的数据 。

由于 `AMap.Polygon` 的 `path` 允许最后一个点与起始点不需要一致,这不符合 `GeoJSON` 规范中对 `RingLine` 的定义。
因此在实际使用时需要进行数据转换。

类型声明:

```ts
const coordsOfGeoJSON2AMapPolygonPath: (
coords: GeoJSON.Position[] | GeoJSON.Polygon['coordinates'] | GeoJSON.MultiPolygon['coordinates']
) => Position[] | Position[][] | Position[][][]
```