Closed damianooldoni closed 2 years ago
ALthough refactoring to sf is something that sooner or later should be done, it seems not solving the problem caused by putting together polygons and lines
study.area_sf <- st_union(ws_bpns_sf, pbarn_freshwater_sf)
class(study.area_sf$geometry)
[1] "sfc_GEOMETRYCOLLECTION" "sfc"
and if I try to run a sf-ized version of find.projections.receivers() I get very soon an error where I try to get some coordinates from the study area:
Error in st_coordinates.sfc(st_geometry(x)) :
not implemented for objects of class sfc_GEOMETRYCOLLECTION
I will try to find a way to make polygons from lines. In this way the union will be still a polygon instead of a collection.
Yes, use mapview code for either lines or polygons only. Use leaflet for a combination of the two.
I am running that chunk, still waiting the crash :smile:
I will reply further on the PR #73.
Merging lines and polygons is possible with
gUnion()
but it will return an object of classspatialCollections
which is not very useful as it is a kind of list, a collection. See problems described in #71 .Moving to sf package I think it becomes unavoidable. However, attention to be paid in the refactoring as we have to be sure that everything can be written using sf.