Skip to content
Prev 6006 / 29559 Next

Distribute points along lines

Roger,

your newer code works fine, thanks.
I'm doing:
 > fl1 <- 
readOGR(dsn="/media/Transcend/MONTSENY2008/MONTSENY_UAV2/Linies_CastVila1",layer="Linies_CastVila1")
 > plot(fl1)
 > points(spsample(fl1[4,],5,offset=0.0,type="regular"))

and points start at the starting point of the line.

Regarding the length, by now I'm using coordinates() to get
the length of each line, i.e.
 > max(dist(as.matrix(coordinates(fl1)[[1]][[1]])))

for the first line. Is there a simpler syntax? I found
the [[1]][[1]] by trial and error, don't actually understand
why the simpler command
 > as.matrix(coordinates(fl1)[[1]])
does not work

I think it would make sense
having a field length in the object as you mentioned, and perhaps also area for 
polygons. Or maybe just having
a function sparealen() to calculate length of lines
and length of each side, perimeter and area of polygons would be
more appropriate.

Thanks

Agus
Roger Bivand wrote:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alobolistas.vcf
Type: text/x-vcard
Size: 251 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090705/016a29cd/attachment.vcf>