Skip to content

mapview crashes with sf objects with empty geometries #504

@sylvaine31

Description

@sylvaine31

No problem for visualizing breweries dataset :

data(breweries, package = "mapview")
mapview::mapview(breweries)

but if there is an empty geometry, it crashes :

empty_geometry <- sf::st_sfc(sf::st_polygon())
breweries$geometry[1] <- empty_geometry

mapview::mapview(breweries)

Image

What is very funny (?), is that if I use an empty geometrycollection instead of an empty polygon, it doesn't crash and works properly...

empty_geometry <- sf::st_sfc(sf::st_geometrycollection())
breweries$geometry[1] <- empty_geometry

mapview::mapview(breweries)

I have no clue what update or change might have caused this issue, but everything was working fine two weeks ago.

Environment:

Windows Version: Windows 10 x64 (build 19045)
RStudio Version: 2024.9.0.375
R Version: R version 4.3.3 (2024-02-29 ucrt)
sf Package Version: 1.0.20
mapview Package Version: 2.11.2

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