Skip to content

Commit

Permalink
st_read substitute "unknown Cartesian" with st_crs(NA)
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Nov 24, 2022
1 parent e0f5f5e commit d016301
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# version 1.0-10

* `st_read()` substitutes CRS `"LOCAL_CS["Undefined Cartesian SRS"]"` with `st_crs(NA)`

* drop the rownames in `st_coordinates()`, to reduce the output size

# version 1.0-9
Expand Down
10 changes: 8 additions & 2 deletions R/read.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@ process_cpl_read_ogr = function(x, quiet = FALSE, ..., check_ring_dir = FALSE,
for (i in seq_along(lc.other))
x[[ nm.lc[i] ]] = list.cols[[i]]

for (i in seq_along(geom))
x[[ nm[i] ]] = st_sfc(geom[[i]], crs = attr(geom[[i]], "crs")) # computes bbox
for (i in seq_along(geom)) {
crs = attr(geom[[i]], "crs")
x[[ nm[i] ]] = st_sfc(geom[[i]], crs = crs) # computes bbox
if (crs == st_crs("LOCAL_CS[\"Undefined Cartesian SRS\"]")) {
message("substituting CRS NA for \"Undefined Cartesian SRS\"")
st_crs(x[[ nm[i] ]]) = NA_crs_
}
}

x = st_as_sf(x, ...,
sf_column_name = if (is.character(geometry_column)) geometry_column else nm[geometry_column],
Expand Down

0 comments on commit d016301

Please sign in to comment.