# @allmaps/types 中文文档

规范地址：https://npmcn.com/package/%40allmaps/types/

版本：1\.0\.0-beta\.24
npm 元数据更新时间：2026-10-01T09:24:41.677Z
中文译文更新时间：2026-11-05T23:51:17.240Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40allmaps/types
原文对照：https://npmcn.com/package/%40allmaps/types/?lang=original
项目主页：https://allmaps.org/
源码仓库：https://github.com/allmaps/allmaps

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：18.7 kB，19 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2023-04-12T12:11:47.872Z
- 最新版本发布：2026-09-22T06:59:43.461Z
- 近 30 天下载量：8930（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：20（近 12 个月 4 个）

## 中文简介

所有地图类型Script类型

## 安装

```sh
npm install @allmaps/types
```

也可以使用：`pnpm add @allmaps/types`、`yarn add @allmaps/types`、`bun add @allmaps/types`

## README

# @ allmaps/ 类型

所有地图类型Script类型

## 几何类型

以下内容: **地貌图** 默认使用 Allmaps 软件包.

```ts
type Point = [number, number]

type LineString = Point[]

type Polygon = Point[][]
// A Polygon is an array of rings of at least three points
// Rings are not closed: the first point is not repeated at the end.
// There is no requirement on winding order.

type MultiPoint = Point[]
// Notice that this is equivalent to the LineString type, hence the `isMultiGeometry` option

type MultiLineString = Point[][]
// Notice that this is equivalent to the Polygon type, hence the `isMultiGeometry` option

type MultiPolygon = Point[][][]

type Geometry =
  | Point
  | LineString
  | Polygon
  | MultiPoint
  | MultiLineString
  | MultiPolygon
```

为了与外部数据互动,还使用了以下类型:

**GeoJSON 地产** 跟着 [GeoJSON 规格](https://geojson.org/)。 。 。 .

**SVG 地产** 使用下列类型表示(但注意有些函数允许 svg 作为字符串传递):

```js
export type SvgCircle = {
  type: 'circle'
  attributes?: SvgAttributes
  coordinates: Point
}

export type SvgLine = {
  type: 'line'
  attributes?: SvgAttributes
  coordinates: [Point, Point]
}

export type SvgPolyLine = {
  type: 'polyline'
  attributes?: SvgAttributes
  coordinates: Point[]
}

export type SvgPolygon = {
  type: 'polygon'
  attributes?: SvgAttributes
  coordinates: Point[]
}

export type SvgRect = {
  type: 'rect'
  attributes?: SvgAttributes
  coordinates: Point[]
}

export type SvgGeometry =
  | SvgCircle
  | SvgLine
  | SvgPolyLine
  | SvgPolygon
  | SvgRect
```

## API 密码

### `Bbox`

纸箱 (`[number, number, number, number]`。定义为 \[xmin, ymin, xMax, yMax\]

### `Color`

###### 类型

```ts
[number, number, number]
```

### `ColorCount`

###### 字段

-   `color` (单位:千美元)`[number, number, number]`(中文(简体) )
-   `count` (单位:千美元)`number`(中文(简体) )

### `ColorWithTransparancy`

###### 类型

```ts
[number, number, number, number]
```

### `FetchFn`

###### 类型

```ts
(
  input: Request | string | URL,
  init?: RequestInit
) => Promise<Response>
```

### `Fit`

两种矩形(或一般形状)可以重叠的方法:(或)`'contain' | 'cover' | 'equal'`) (中文(简体) ).

-   "夹": 第一个包含第二个
-   "封面": 第一个是第二个
-   “ 平等 ” : 第一个和第二个大小相同

### `Gcp`

###### 字段

-   `geo` (单位:千美元)`[number, number]`(中文(简体) )
-   `resource` (单位:千美元)`[number, number]`(中文(简体) )

### `GeojsonFeature`

###### 字段

-   `geometry` (单位:千美元) `| GeojsonLineString | GeojsonMultiLineString | GeojsonMultiPoint | GeojsonMultiPolygon | GeojsonPoint | GeojsonPolygon`(中文(简体) )
-   `properties` (单位:千美元)`unknown`(中文(简体) )
-   `type` (单位:千美元)`'Feature'`(中文(简体) )

### `GeojsonFeatureCollection`

###### 字段

-   `features` (单位:千美元)`Array<GeojsonFeature>`(中文(简体) )
-   `type` (单位:千美元)`'FeatureCollection'`(中文(简体) )

### `GeojsonGeometry`

###### 类型

```ts
  | GeojsonLineString
  | GeojsonMultiLineString
  | GeojsonMultiPoint
  | GeojsonMultiPolygon
  | GeojsonPoint
  | GeojsonPolygon
```

### `GeojsonGeometryType`

###### 类型

```ts
  | 'LineString'
  | 'MultiLineString'
  | 'MultiPoint'
  | 'MultiPolygon'
  | 'Point'
  | 'Polygon'
```

### `GeojsonLineString`

###### 字段

-   `coordinates` (单位:千美元)`Array<Array<number>>`(中文(简体) )
-   `type` (单位:千美元)`'LineString'`(中文(简体) )

### `GeojsonMultiGeometry`

###### 类型

```ts
GeojsonMultiLineString | GeojsonMultiPoint | GeojsonMultiPolygon
```

### `GeojsonMultiLineString`

###### 字段

-   `coordinates` (单位:千美元)`Array<Array<Array<number>>>`(中文(简体) )
-   `type` (单位:千美元)`'MultiLineString'`(中文(简体) )

### `GeojsonMultiPoint`

###### 字段

-   `coordinates` (单位:千美元)`Array<Array<number>>`(中文(简体) )
-   `type` (单位:千美元)`'MultiPoint'`(中文(简体) )

### `GeojsonMultiPolygon`

###### 字段

-   `coordinates` (单位:千美元)`Array<Array<Array<Array<number>>>>`(中文(简体) )
-   `type` (单位:千美元)`'MultiPolygon'`(中文(简体) )

### `GeojsonPoint`

###### 字段

-   `coordinates` (单位:千美元)`Array<number>`(中文(简体) )
-   `type` (单位:千美元)`'Point'`(中文(简体) )

### `GeojsonPolygon`

###### 字段

-   `coordinates` (单位:千美元)`Array<Array<Array<number>>>`(中文(简体) )
-   `type` (单位:千美元)`'Polygon'`(中文(简体) )

### `Geometry`

###### 类型

```ts
  LineString | MultiLineString | MultiPoint | MultiPolygon | Point | Polygon
```

### `Histogram`

###### 字段

-   `[bin: string]` (单位:千美元)`{count: number; color: Color}`(中文(简体) )

### `HomogeneousTransform`

2D 同位变换矩阵的重量阵列

这些系数在多处使用顺序相同

-   CSS Transform由2D矩阵定义. 使用 `toString()` 用于 CSS 输入前 `matrix()` 函数.
-   WebGL 二维变换矩阵.
-   OpenLayers的变身课.

见: [https://developer.mozilla.org/en-US/docs/Web/CSS/transform-函数/matrix 互联网档案馆的存檔,存档日期2013-12-22](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) 见: [https://openlayers.org/en/latest/apidoc/module-ol transform.html 页面存档备份,存于互联网档案馆](https://openlayers.org/en/latest/apidoc/module-ol_transform.html)

注意: Polynomial1变换的权重阵列有不同的顺序. 参见相应的转换功能.

###### 类型

```ts
[number, number, number, number, number, number]
```

### `ImageRequest`

###### 字段

-   `region?` (单位:千美元)`{x: number; y: number; width: number; height: number}`(中文(简体) )
-   `size?` (单位:千美元)`{width: number; height: number}`(中文(简体) )

### `Line`

###### 类型

```ts
[Point, Point]
```

### `LineString`

###### 类型

```ts
Array<Point>
```

### `Matrix4`

###### 类型

```ts
[
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number
]
```

### `MultiGeometryOptions`

###### 字段

-   `isMultiGeometry` (单位:千美元)`boolean`(中文(简体) )

### `MultiLineString`

###### 类型

```ts
Array<Array<Point>>
```

### `MultiPoint`

###### 类型

```ts
Array<Point>
```

### `MultiPolygon`

###### 类型

```ts
Array<Array<Array<Point>>>
```

### `Point`

###### 类型

```ts
[number, number]
```

### `Polygon`

###### 类型

```ts
Array<Array<Point>>
```

### `Rectangle`

矩形(或可能为四边形) (`[Point, Point, Point, Point]`) (中文(简体) ). 风起起分相自在.

### `Region`

###### 字段

-   `height` (单位:千美元)`number`(中文(简体) )
-   `width` (单位:千美元)`number`(中文(简体) )
-   `x` (单位:千美元)`number`(中文(简体) )
-   `y` (单位:千美元)`number`(中文(简体) )

### `Ring`

环为 `[[number, number], ...]` (单位:千美元)`Array<Point>`) (中文(简体) ).

必须包含至少3个点 可能不包含重复点 必须是未关闭的: 最后一个元素不是重复第一个元素 可能不是自我交流 迄今没有关于自我交流的要求,尽管这在今后可能有用 迄今为止,没有关于整风令的要求。 这只有在导出到 GeoJSON 时才适用

### `Size`

两个数字表示 Bbox 的大小为 \[宽,高\] 或 \[xSize, ySize\] (`[number, number]`) (中文(简体) ). 或者,两个数字表示数字的最小和最大,例如: 或者,两个数字表示矩阵的尺寸:行,相(这是不同的手性!)

### `SizeObject`

###### 字段

-   `height` (单位:千美元)`number`(中文(简体) )
-   `width` (单位:千美元)`number`(中文(简体) )

### `SvgAttributes`

###### 类型

```ts
{[x: string]: string | number}
```

### `SvgCircle`

###### 字段

-   `attributes?` (单位:千美元)`{[x: string]: string | number}`(中文(简体) )
-   `coordinates` (单位:千美元)`[number, number]`(中文(简体) )
-   `type` (单位:千美元)`'circle'`(中文(简体) )

### `SvgGeometry`

###### 类型

```ts
SvgCircle | SvgLine | SvgPolyLine | SvgPolygon | SvgRect
```

### `SvgLine`

###### 字段

-   `attributes?` (单位:千美元)`{[x: string]: string | number}`(中文(简体) )
-   `coordinates` (单位:千美元)`[Point, Point]`(中文(简体) )
-   `type` (单位:千美元)`'line'`(中文(简体) )

### `SvgPolyLine`

###### 字段

-   `attributes?` (单位:千美元)`{[x: string]: string | number}`(中文(简体) )
-   `coordinates` (单位:千美元)`Array<Point>`(中文(简体) )
-   `type` (单位:千美元)`'polyline'`(中文(简体) )

### `SvgPolygon`

###### 字段

-   `attributes?` (单位:千美元)`{[x: string]: string | number}`(中文(简体) )
-   `coordinates` (单位:千美元)`Array<Point>`(中文(简体) )
-   `type` (单位:千美元)`'polygon'`(中文(简体) )

### `SvgRect`

###### 字段

-   `attributes?` (单位:千美元)`{[x: string]: string | number}`(中文(简体) )
-   `coordinates` (单位:千美元)`Array<Point>`(中文(简体) )
-   `type` (单位:千美元)`'rect'`(中文(简体) )

### `Tile`

###### 字段

-   `column` (单位:千美元)`number`(中文(简体) )
-   `imageSize` (单位:千美元)`[number, number]`(中文(简体) )
-   `row` (单位:千美元)`number`(中文(简体) )
-   `tileZoomLevel` (单位:千美元)`{ scaleFactor: number width: number height: number originalWidth: number originalHeight: number columns: number rows: number }`(中文(简体) )

### `TileByColumn`

###### 字段

-   `[key: number]` (单位:千美元)`[number, number]`(中文(简体) )

### `TileZoomLevel`

###### 字段

-   `columns` (单位:千美元)`number`(中文(简体) )
-   `height` (单位:千美元)`number`(中文(简体) )
-   `originalHeight` (单位:千美元)`number`(中文(简体) )
-   `originalWidth` (单位:千美元)`number`(中文(简体) )
-   `rows` (单位:千美元)`number`(中文(简体) )
-   `scaleFactor` (单位:千美元)`number`(中文(简体) )
-   `width` (单位:千美元)`number`(中文(简体) )

### `Triangle`

三角形 作为 `[[x0, y0], [x1, y1], [x2, y2]]` (单位:千美元)`[Point, Point, Point]`) (中文(简体) ).

风起起分相自在.

### `TypedGeometry`

###### 类型

```ts
P | TypedLineString<P> | TypedMultiLineString<P> | TypedMultiPoint<P> | TypedMultiPolygon<P> | TypedPolygon<...>
```

### `TypedLine`

###### 类型

```ts
[P, P]
```

### `TypedLineString`

###### 类型

```ts
Array<P>
```

### `TypedMultiLineString`

###### 类型

```ts
Array<Array<P>>
```

### `TypedMultiPoint`

###### 类型

```ts
Array<P>
```

### `TypedMultiPolygon`

###### 类型

```ts
Array<Array<Array<P>>>
```

### `TypedPolygon`

###### 类型

```ts
Array<Array<P>>
```

### `TypedRectangle`

###### 类型

```ts
[P, P, P, P]
```

### `TypedRing`

###### 类型

```ts
Array<P>
```

### `TypedTriangle`

###### 类型

```ts
[P, P, P]
```

## 常见问题

### @allmaps/types 是什么？

所有地图类型Script类型

### 如何安装 @allmaps/types？

在项目目录运行 npm install @allmaps/types，或使用 pnpm add / yarn add / bun add。

### @allmaps/types 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/allmaps\_\_types 是否存在。

### @allmaps/types 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @allmaps/types 可以商用吗？

@allmaps/types 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @allmaps/types 的下载量有多少？

根据 npm 官方下载统计，@allmaps/types 在 2026/10/06 – 2026/11/04 这 30 天内被下载 8,930 次，日均约 298 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @allmaps/types 还在维护吗？

最新版本 1\.0\.0-beta\.24 发布于 2026/09/22（1 个月前）；至今共发布 20 个版本，其中过去 12 个月发布了 4 个；首次发布于 2023/04/12。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

