Skip to content
Prev 12900 / 29559 Next

[spatstat] problem with a psp Line Segment Pattern when plotting and pointsOnlines performing

It seems it is because one of your line segments is of length zero,
using your attachment:

load("track.RData")
library(spatstat)
which(!lengths.psp(track.psp) > 0)
[1] 17

Dropping the offender:

noZeroLengths <- track.psp[lengths.psp(track.psp) > 0]

(pts <- pointsOnLines(noZeroLengths, eps=50))
 planar point pattern: 1134 points
window: rectangle = [865841.7, 888666.8] x [6265115, 6300668] units

You might want to investigate why you have a zero length line segment
in your original shapefile, there's a lot of options for what you
might do in R but where you catch it depends on your main goals I
guess.

I think there are some good suggestions here for catching these cases
in spatstat and sp, but I haven't looked closely enough yet to say
anything helpful.

Cheers, Mike.

On Thu, Sep 22, 2011 at 9:00 PM, Mathieu Rajerison
<mathieu.rajerison at gmail.com> wrote: