# @mapbox/geojson-coords

> return all coordinates from a geojson object

Latest version **0.1.0** (published 2026-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @mapbox/geojson-coords
pnpm add @mapbox/geojson-coords
yarn add @mapbox/geojson-coords
bun add @mapbox/geojson-coords
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2026-11-09 |
| First published | 2017-01-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 33 |
| Author | Tom MacWright |
| Maintainers | mapbox-npm-01, mapbox-npm-02, mapbox-npm-07, mapbox-npm-03, mapbox-npm-04, mapbox-npm-09, mapbox-npm-05, mapbox-npm-06, mapbox-npm-08, mapbox-npm-advanced-actions, mapbox-npm-ci, mapbox-npm, mapbox-admin, mapbox-machine-user, mbx-npm-ci-staging, mbx-npm-ci-production, mbx-npm-01-production, mbx-npm-02-production, mbx-npm-03-production, mbx-npm-04-production, mbx-npm-05-production, mbx-npm-06-production, mbx-npm-07-production, mbx-npm-08-production, mbx-npm-09-production, mbx-npm-02-staging, mbx-npm-advanced-actions-staging, mbx-npm-advanced-actions-production |
| Keywords | geojson, coords, browser, coordinates |

## Links

- npm: https://www.npmjs.com/package/@mapbox/geojson-coords
- Repository: https://github.com/mapbox/geojson-coords
- Issues: https://github.com/mapbox/geojson-coords/issues
- npm.io page: https://npm.io/package/@mapbox/geojson-coords

## Dependencies (2)

- [geojson-flatten](https://npm.io/package/geojson-flatten.md) ^1.0.4
- [@mapbox/geojson-normalize](https://npm.io/package/@mapbox/geojson-normalize.md) 0.0.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2026-11-09
- 0.0.3-275823a (prerelease) — 2026-10-30
- 0.0.2 — 2021-09-13
- 0.0.1 — 2020-09-18
- 0.0.0 — 2017-01-17

## README

# geojson-coords

Extract coordinates from [GeoJSON](http://geojson.org/).

## install

    npm install --save @mapbox/geojson-coords

## api

### `coords(geojson)`

Given any valid GeoJSON object, return a single array of coordinates that
it contains. Handles any root object, collapses multidimensional coordinate arrays
and expands point coordinate arrays.

## example

```js
var geojsonCoords = require('@mapbox/geojson-coords');

geojsonCoords({
    "type": "GeometryCollection",
    "geometries": [
        {
            "type": "Point",
            "coordinates": [100.0, 0.0]
        },
        {
            "type": "LineString",
            "coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
        }
    ]
});
// returns [[100, 0], [101, 0], [102, 1]];

## publishing

Pull Requests to `main` automatically publish a new version based on the PR's title prefix (`major:`, `minor:` or `patch:`) to the npmjs registry.

The published version in the registry is the source of truth for the package version, but you can manually increment the `package.json`'s `version`.

### pre-release versions on other branches

For testing in downstream projects, you can manually trigger the "NPM release" workflow on a branch to publish a pre-release tagged with the short commit sha (e.g. `0.0.2-aa79c6a`) under the npm `prerelease` dist-tag, without affecting `latest`. Check the workflow results for the published version.

---
_Source: https://npm.io/package/@mapbox/geojson-coords · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
