Skip to content

Intersect - "Must specify at least 2 geometries" #3028

@gianniw11

Description

@gianniw11

I'm using version 7.3.4 within a NextJS project.
The following code, lifted directly from the documentation:

var poly1 = turf.polygon([
    [
        [-122.801742, 45.48565],
        [-122.801742, 45.60491],
        [-122.584762, 45.60491],
        [-122.584762, 45.48565],
        [-122.801742, 45.48565],
    ],
    ]);

    var poly2 = turf.polygon([
    [
        [-122.520217, 45.535693],
        [-122.64038, 45.553967],
        [-122.720031, 45.526554],
        [-122.669906, 45.507309],
        [-122.723464, 45.446643],
        [-122.532577, 45.408574],
        [-122.487258, 45.477466],
        [-122.520217, 45.535693],
    ],
    ]);

    var intersection = turf.intersect(turf.featureCollection([poly1, poly2]));

Gives the following error on the final line: Must specify at least 2 geometries. I'm not sure whether the documentation is wrong, or there is a bug in the intersect function. If the former, what is the correct usage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions