# @types/polygon-lookup

> TypeScript definitions for polygon-lookup

Latest version **2.6.6** (published 2024-09-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/polygon-lookup
pnpm add @types/polygon-lookup
yarn add @types/polygon-lookup
bun add @types/polygon-lookup
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.6.6 |
| Published | 2024-09-26 |
| First published | 2020-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51440 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/polygon-lookup
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/polygon-lookup
- npm.io page: https://npm.io/package/@types/polygon-lookup

## Dependencies (2)

- [@types/rbush](https://npm.io/package/@types/rbush.md) ^3
- [@types/geojson](https://npm.io/package/@types/geojson.md) *

## Recent versions

- 2.6.6 (latest) — 2024-09-26
- 2.6.4 (ts4.7) — 2023-11-07
- 2.6.1 (ts4.4) — 2023-04-30
- 2.6.0 (ts3.0) — 2020-07-28
- 2.6.5 — 2024-08-19
- 2.6.3 — 2023-10-18
- 2.6.2 — 2023-09-24

## README

# Installation
> `npm install --save @types/polygon-lookup`

# Summary
This package contains type definitions for polygon-lookup (https://github.com/pelias/polygon-lookup).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/polygon-lookup.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/polygon-lookup/index.d.ts)
````ts
import { Feature, FeatureCollection, Polygon } from "geojson";
import RBush = require("rbush");

declare namespace PolygonLookup {
    interface BBox {
        maxX: number;
        maxY: number;
        minX: number;
        minY: number;
    }
}

declare class PolygonLookup {
    constructor(featureCollection?: FeatureCollection);

    /** A spatial index for `this.polygons`. */
    rtree: RBush<PolygonLookup.BBox[]>;
    polygons: FeatureCollection;

    /**
     * Find polygon(s) that a point intersects. Execute a bounding-box search to
     * narrow down the candidate polygons to a small subset, and then perform
     * additional point-in-polygon intersections to resolve any ambiguities.
     *
     * @param x The x-coordinate of the point.
     * @param y The y-coordinate of the point.
     * @param limit Number of results to return (`-1` to return all the results).
     * @return  If one or more bounding box intersections are
     * found and limit is `undefined`, return the first feature that intersects
     * (`x`, `y`); otherwise, `undefined`. If a limit is passed in, return
     * intersecting polygons as a GeoJSON `FeatureCollection`.
     */
    search(x: number, y: number): Feature<Polygon> | undefined;
    search(x: number, y: number, limit: number): FeatureCollection<Polygon> | undefined;

    /**
     * Build a spatial index for a set of polygons, and store both the polygons and
     * the index in this `PolygonLookup`.
     *
     * @param collection A GeoJSON-formatted `FeatureCollection`.
     */
    loadFeatureCollection(collection: FeatureCollection): void;
}

export = PolygonLookup;

````

### Additional Details
 * Last updated: Thu, 26 Sep 2024 17:08:07 GMT
 * Dependencies: [@types/geojson](https://npmjs.com/package/@types/geojson), [@types/rbush](https://npmjs.com/package/@types/rbush)

# Credits
These definitions were written by [Florian Keller](https://github.com/ffflorian).

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