r-spatial / lwgeom

bindings to the liblwgeom library
https://r-spatial.github.io/lwgeom/
58 stars 23 forks source link

st_perimeter() fails with crs NA #31

Closed MatthieuStigler closed 5 years ago

MatthieuStigler commented 5 years ago

st_perimeter has a check such as: Error in if (st_is_longlat(x))

unfortunately, this will fail if the st_is_longlat(x) is NA, with error message: Error in if (st_is_longlat(x)) stop("for perimeter of longlat geometry, cast to LINESTRING and use st_length") : missing value where TRUE/FALSE needed

Could the function handle this case? Maybe if (isTRUE(st_is_longlat(x))) ? Or return stop in any case?

Thanks!

edzer commented 5 years ago

Thanks!