Skip to content
Prev 26779 / 29559 Next

Spatial Query (Selection) with Apply

Thanks, Robin

It worked perfectly, although I transformed the data from sf to
SpatialDataFrame objects with:

zones <- as(zones, "Spatial")
nodes <- as(nodes, "Spatial")

The next step I will follow is to create Distance Matrix like this:

coord <- tmp2[[1]]@coords
dist1 <- apply(X = coord, MARGIN = 1, FUN = function(x) spDistsN1(coord, x,
longlat = T))

obviously, the task is a distance matrix for every selection. ?What would
you recommend, the aggregate function as you talked before or something
like a nested apply?

Regards,
Ariel



2018-08-27 19:32 GMT-03:00 Robin Lovelace <rob00x at gmail.com>: