Skip to content

st_intersection fails with census data #2489

@kmichelson

Description

@kmichelson

Describe the bug
When attempting to use st_intersection with a multipolygon downloaded directly from the US Census representing two Florida cities and a multipolygon representing a single Florida ZIP, the following error is given:
Error in [[<-.data.frame(*tmp*, attr(x, "sf_column"), value = list( :
replacement has 4 rows, data has 2

To Reproduce
Load the two SFCs and perform st_intersection(x,y) - I have attached a ZIP containing x and y as SHP files and both SFCsh in an rdata file

Additional context
The polygons are attached to this bug report

R version 4.4.0 (2024-04-24) Platform: aarch64-apple-darwin20 Running under: macOS 15.1.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] sf_1.0-18

loaded via a namespace (and not attached):
[1] compiler_4.4.0 magrittr_2.0.3 class_7.3-22 s2_1.1.6
[5] DBI_1.2.2 tools_4.4.0 units_0.8-5 proxy_0.4-27
[9] rstudioapi_0.16.0 wk_0.9.1 Rcpp_1.0.12 KernSmooth_2.23-22
[13] grid_4.4.0 e1071_1.7-14 classInt_0.4-10

[mwe.zip](https://github.com/user-attachments/files/18129047/mwe.zip)

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