Skip to content

add_polygon_layer incompatible with sf #222

@sdamerdji

Description

@sdamerdji

Documentation claims:

An object of class sf is a data.frame with a geometry list-column. Set the layer prop that fetches the geometry to the geometry list-column of your sf object:

> # Example: PolygonLayer
> 
> props <- list(
>   getPolygon = ~geometry
>   # ...
> )

This R script shows this is not the case.

library(sf)
library(deckgl)


nc <- st_read(system.file("shape/nc.shp", package="sf"))

deck <- deckgl() %>%
  add_polygon_layer(
    data = nc,
    properties = list(getPolygon = ~geometry)
    ) %>%
  add_basemap()


if (interactive()) deck

When opened and inspected in the browser, there is the following error "deck: error during initialization of PolygonLayer({id: 'polygon-layer'}) Error: invalid polygon"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions