We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

1

For the example you've shown a convex hull is the easiest way to enclose all points in a polygon. For a sp object you could use the convex hull algorithm from rGeos. I'm not sure if rGeos is compatible with sf. If any of your desired polygons has a concave vertex you'll need a routine that traces the points in a specified order.


3

You can use centroid.owin to find the centroid of an owin and shift to translate an owin. Let's put your polys in a list: > polys = list(test.owin, test.owin2, test.owin3) And shift them all to have centroid (0,0): > zpolys = lapply(polys, function(p){ce=centroid.owin(p);shift(p,c(-ce$x, -ce$y))}) > plot(zpolys[[3]]) > > plot(zpolys[[2]]...


2

If you are working with old wgs84 coordinates you can substitute etrs89 with wgs84. Etrs89 is wgs84 attached to the european continental plate. Wgs84 observations in 1989.0 are identical to Etrs89. Starting from 1989 there is a shift of approx 2.5 cm per year. So if your details are less than a meter, the difference between etrs89 and wgs84 is academic.


1

The help for st_read shows: st_read(dsn, layer, ..., query = NA, options = NULL, quiet = FALSE, geometry_column = 1L, type = 0, promote_to_multi = TRUE, stringsAsFactors = default.stringsAsFactors(), int64_as_string = FALSE, check_ring_dir = FALSE, fid_column_name = character(0)) where: stringsAsFactors: logical; logical: should character ...


1

First, thanks for making a reproducible example even though it has a few issues. We like to be able to cut and paste code from here to see what your problem is so having install.packages is not a good idea. Also you don't say how long that Monte-carlo takes to run, which meant I nearly gave up after a minute. If you can supply data or generate test data in ...


0

Are you calling as.character on the whole table or just the column? simp_sf$NAME_1 <- as.character(simp_sf$NAME_1) is not working?


Top 50 recent answers are included