2.2.3 • Published 6 months ago

@types/which-polygon v2.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/which-polygon

Summary

This package contains type definitions for which-polygon (https://github.com/mapbox/which-polygon).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which-polygon.

index.d.ts

// Type definitions for which-polygon 2.2
// Project: https://github.com/mapbox/which-polygon
// Definitions by: Kyle Hensel <https://github.com/k-yle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 4.0

import { Geometry, GeoJsonProperties, FeatureCollection } from 'geojson';
import RBush from 'rbush';

declare namespace whichPolygon {
    type Coordinates = [lng: number, lat: number];

    type BBox = [minLat: number, maxLat: number, minLng: number, maxLng: number];

    interface Query<Properties> {
        (coordinates: Coordinates, multi: true): Properties[] | null;
        (coordinates: Coordinates, multi?: false): Properties | null;

        bbox(bbox: BBox): Properties[];

        /** @internal */
        tree: RBush<unknown>;
    }

    type GeoJson<Properties> = FeatureCollection<Geometry, Properties>;
}

/**
 * The input GeoJSON must be a feature collection of polygons or multipolygons.
 * The query returns the properties of the matched polygon feature.
 */
declare function whichPolygon<Properties = GeoJsonProperties>(
    data: whichPolygon.GeoJson<Properties>,
): whichPolygon.Query<Properties>;

export = whichPolygon;

Additional Details

Credits

These definitions were written by Kyle Hensel.

2.2.1

8 months ago

2.2.3

6 months ago

2.2.2

7 months ago

2.2.0

3 years ago