npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@allmaps/types

v1.0.0-beta.22

Published

Allmaps TypeScript types

Readme

@allmaps/types

Allmaps TypeScript types

Geometry types

The following Geometries are used by default Allmaps packages.

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

To interact with external data, the following types are used as well:

GeoJSON Geometries follow the GeoJSON specification.

SVG Geometries are expressed using the following types (but note that some functions allow svg's to be passed as a string):

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

Bbox ([number, number, number, number]). Defined as [xMin, yMin, xMax, yMax]

BboxOptions

Fields
  • clipLngLat (boolean)
  • clipWebMercator (boolean)

Color

Type
[number, number, number]

ColorCount

Fields
  • color ([number, number, number])
  • count (number)

ColorWithTransparancy

Type
[number, number, number, number]

FetchFn

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

Fit

Two ways two rectangles (or shapes in general) can overlap: ('cover' | 'contain').

  • 'contain': The first contains the second
  • 'cover': The first is covered by the second

Gcp

Fields
  • geo ([number, number])
  • resource ([number, number])

GeojsonFeature

Fields
  • geometry ( | GeojsonPoint | GeojsonLineString | GeojsonPolygon | GeojsonMultiPoint | GeojsonMultiLineString | GeojsonMultiPolygon)
  • properties (unknown)
  • type ('Feature')

GeojsonFeatureCollection

Fields
  • features (Array<GeojsonFeature>)
  • type ('FeatureCollection')

GeojsonGeometry

Type
  | GeojsonPoint
  | GeojsonLineString
  | GeojsonPolygon
  | GeojsonMultiPoint
  | GeojsonMultiLineString
  | GeojsonMultiPolygon

GeojsonGeometryType

Type
  | 'Point'
  | 'LineString'
  | 'Polygon'
  | 'MultiPoint'
  | 'MultiLineString'
  | 'MultiPolygon'

GeojsonLineString

Fields
  • coordinates (Array<Array<number>>)
  • type ('LineString')

GeojsonMultiGeometry

Type
GeojsonMultiPoint | GeojsonMultiLineString | GeojsonMultiPolygon

GeojsonMultiLineString

Fields
  • coordinates (Array<Array<Array<number>>>)
  • type ('MultiLineString')

GeojsonMultiPoint

Fields
  • coordinates (Array<Array<number>>)
  • type ('MultiPoint')

GeojsonMultiPolygon

Fields
  • coordinates (Array<Array<Array<Array<number>>>>)
  • type ('MultiPolygon')

GeojsonPoint

Fields
  • coordinates (Array<number>)
  • type ('Point')

GeojsonPolygon

Fields
  • coordinates (Array<Array<Array<number>>>)
  • type ('Polygon')

Geometry

Type
  | Point
  | LineString
  | Polygon
  | MultiPoint
  | MultiLineString
  | MultiPolygon

Histogram

Fields
  • [bin: string] ({count: number; color: Color})

HomogeneousTransform

Weights array of a 2D Homogeneous Transform Matrix

These coefficients are used in the same order in multiple places

  • CSS Transform defined by a 2D matrix. Use toString() before using this as input for a CSS matrix() function.
  • WebGL 2D transform matrices.
  • OpenLayers' transform class.

See: https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix See: https://openlayers.org/en/latest/apidoc/module-ol_transform.html

Note: The weights array of a Polynomial1 Transformation has a different order. See the corresponding conversion functions.

Type
[number, number, number, number, number, number]

ImageRequest

Fields
  • region? ({x: number; y: number; width: number; height: number})
  • size? ({width: number; height: number})

Line

Type
[Point, Point]

LineString

Type
Array<Point>

Matrix4

Type
[
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number,
  number
]

MultiGeometryOptions

Fields
  • isMultiGeometry (boolean)

MultiLineString

Type
Array<Array<Point>>

MultiPoint

Type
Array<Point>

MultiPolygon

Type
Array<Array<Array<Point>>>

Point

Type
[number, number]

Polygon

Type
Array<Array<Point>>

Rectangle

Rectangle (or possibly quadrilateral) ([Point, Point, Point, Point]). Winding order of points is free.

Region

Fields
  • height (number)
  • width (number)
  • x (number)
  • y (number)

Ring

Ring as [[number, number], ...] (Array<Point>).

Must contain at least 3 points May not contain duplicate points Must be unclosed: last element is not a repetition of the first May not be self-intersecting So far no requirement on self-intersection although that may be useful in future So far no requirement on winding order. This is only applied when exporting to GeoJSON

Size

Two numbers indicating the size of a Bbox as [width, height] or [xSize, ySize] ([number, number]). Alternatively, two numbers indicating the minimum and maximum of, for example, an array of numbers Alternatively, two numbers indicating the dimensions of a matrix: rows, cols (which is a different handedness!)

SizeObject

Fields
  • height (number)
  • width (number)

SvgAttributes

Type
{[x: string]: string | number}

SvgCircle

Fields
  • attributes? ({[x: string]: string | number})
  • coordinates ([number, number])
  • type ('circle')

SvgGeometry

Type
SvgCircle | SvgLine | SvgPolyLine | SvgPolygon | SvgRect

SvgLine

Fields
  • attributes? ({[x: string]: string | number})
  • coordinates ([Point, Point])
  • type ('line')

SvgPolyLine

Fields
  • attributes? ({[x: string]: string | number})
  • coordinates (Array<Point>)
  • type ('polyline')

SvgPolygon

Fields
  • attributes? ({[x: string]: string | number})
  • coordinates (Array<Point>)
  • type ('polygon')

SvgRect

Fields
  • attributes? ({[x: string]: string | number})
  • coordinates (Array<Point>)
  • type ('rect')

Tile

Fields
  • column (number)
  • imageSize ([number, number])
  • row (number)
  • tileZoomLevel ({ scaleFactor: number width: number height: number originalWidth: number originalHeight: number columns: number rows: number })

TileByColumn

Fields
  • [key: number] ([number, number])

TileZoomLevel

Fields
  • columns (number)
  • height (number)
  • originalHeight (number)
  • originalWidth (number)
  • rows (number)
  • scaleFactor (number)
  • width (number)

Triangle

Triangle As [[x0, y0], [x1, y1], [x2, y2]] ([Point, Point, Point]).

Winding order of points is free.

TypedGeometry

Type
P | TypedLineString<P> | TypedPolygon<P> | TypedMultiPoint<P> | TypedMultiLineString<P> | TypedMultiPolygon<...>

TypedLine

Type
[P, P]

TypedLineString

Type
Array<P>

TypedMultiLineString

Type
Array<Array<P>>

TypedMultiPoint

Type
Array<P>

TypedMultiPolygon

Type
Array<Array<Array<P>>>

TypedPolygon

Type
Array<Array<P>>

TypedRectangle

Type
[P, P, P, P]

TypedRing

Type
Array<P>

TypedTriangle

Type
[P, P, P]