Re: [R-sig-Geo] Create pixels neighborhood in a raster [solved]

2020-11-10 Thread Ege Rubak
A quick-and-dirty all spatstat solution: library(spatstat) eps <- 10 x <- pixellate(ants, eps = eps) x[x>0] <- 1 y <- 0*x s <- eps*c(-1,0,1) for(i in s){ for(j in s){ y <- y + shift.im(x, vec = c(i,j)) } } z <- y z[z>0] <- 1 plot(solist(x, y, z), main = "") /Ege On Tue, 2020-11-10 at

Re: [R-sig-Geo] Computing pairwise minimum distance moving only within clipped area

2019-10-15 Thread Ege Rubak
From the documentation of gDistance I would be very suprised if it confines paths to be inside the polygon. Try to make a simple example "by hand" and check the calculations. This is a well studied problem in computer science (search for something like "shortest path inside polygon"), and

Re: [R-sig-Geo] Rasterize point process using specific rule

2019-08-21 Thread Ege Rubak
If I understand your question correctly you can simply use the spatstat function `discs()`. Given `syn.ppp` created from your code the call is something like: D <- discs(syn.ppp, radii = marks(syn.ppp)/2, mask = TRUE, eps = 1) For your dataset this covers almost the entire window if both

Re: [R-sig-Geo] Create Kernel image results in *tif format

2018-09-27 Thread Ege Rubak
Dear Alexandre, Indeed the solution by Florian below is very nice. If you really want to go the other direction you can use `as.SpatialGridDataFrame.im()` from the `maptools` package. By the way, based on what you write, I think you mean to use the value 7.5 (=0.75m) rather than 0.75

Re: [R-sig-Geo] sf/ggplot version hell....

2018-02-03 Thread Ege Rubak
The usual thing I've seen (e.g. in a workshop by Edzer Pebesma) is "You need the development version of ggplot2...". Of course that can't be true forever, but maybe it still is. If you have either the `devtools` or `remotes` package installed you can just install the GitHub version of `ggplot2`

Re: [R-sig-Geo] Splitting spatial lines at self intersections (line crossings)

2018-01-25 Thread Ege Rubak
The `psp` class in spatstat consists of individual line segments and `selfcrossing.psp` checks whether each individual line intersects one of the other lines, which happens at all the points in your plot. If instead you treat each of the two line sequences as a `psp` you can check find the

Re: [R-sig-Geo] Anisotropic point processes are inhomogeneous?

2017-11-21 Thread Ege Rubak
At least the typical definition of an inhomogeneous K-function uses a disc as the structure element and can't capture anisotropy as far as I can see. It only depends on distance between points and not the vector difference. Btw. if you do not assume stationarity of your process I would think

Re: [R-sig-Geo] Autologistic regression in R

2017-11-15 Thread Ege Rubak
, so I may have some misunderstanding. Thanks again. Erin *From:* R-sig-Geo <r-sig-geo-boun...@r-project.org> on behalf of Ege Rubak <ru...@math.aau.dk> *Sent:* November 15, 2017 10:59:05 AM *To:* r-sig

Re: [R-sig-Geo] Autologistic regression in R

2017-11-15 Thread Ege Rubak
Hi Erin, It is not quite clear to me what your data is. From your text I understand that you have a number of locations where you have measured the population of a specific insect (count variable?) together with independent/explanatory variables at these same locations. Is the "population"

Re: [R-sig-Geo] quadracount on multitype points

2017-09-13 Thread Ege Rubak
al Message- From: Rolf Turner [mailto:r.tur...@auckland.ac.nz] Sent: September 12, 2017 3:45 PM To: Guy Bayegnak <guy.bayeg...@gov.ab.ca> Cc: r-sig-geo@r-project.org; adrian.badde...@curtin.edu.au; Ege Rubak <ru...@math.aau.dk> Subject: Re: [R-sig-Geo] quadracount on multitype p