Skip to content

Why does @turf/boolean-valid require MultiLineStrings to have at least two component LineStrings? #2837

Open
@benjaminblack

Description

@benjaminblack

I assume the OGC Simple Features spec mandates this but I am unable to find a source:

boolean-valid will reject a MultiLineString which has coordinates with only one LineString, e.g. "coordinates": [ [...] ]

The GeoJSON spec is frustratingly silent on whether or not MultiLineString coordinates can be empty; however, we frequently encounter GeoJSON MultiLineStrings composed of a single LineString, typically from GPS devices.

Curiously, for the other multipart geometries, boolean-valid does not enforce this. Why is that?

A GeometryCollection with an empty "geometries": [] is similarly rejected, though the GeoJSON spec explicitly allows this. Again, I assume the reason is the OGC spec, but I can't find a direct source.

As for MultiLineStrings, I observe that the case for MultiLineString is identical to the case for LineString, which would suggest this is a actually a bug; or at least that the MultiLineString case is missing an inner loop to validate that each coordinate has at least lng and lat, as is done with LineStrings.

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