Skip to content

Commit c860f68

Browse files
committed
fix z_range/m_range setting
1 parent 4187a8c commit c860f68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/sf.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ st_as_sf.data.frame = function(x, ..., agr = NA_agr_, coords, wkt,
7474
coords = match(coords, names(x))
7575
x = x[-coords]
7676
}
77-
if (grepl("Z", dim))
77+
if (length(coords) > 2 && grepl("Z", dim))
7878
attr(x[[sf_column_name]], "z_range") = compute_z_range(x[[sf_column_name]])
79-
if (grepl("M", dim))
79+
if (length(coords) > 2 && grepl("M", dim))
8080
attr(x[[sf_column_name]], "m_range") = compute_m_range(x[[sf_column_name]])
8181

8282
}

0 commit comments

Comments
 (0)