Re: [R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

2012-11-15 Thread Roger Bivand
On Thu, 15 Nov 2012, peleve wrote: Thanks Robert, I was able to do it with the following using the 'gpclib" package: For completeness, please use rgeos rather than gpclib, which we are advising against strongly, because of the unclear and very restrictive licence of its included C code. rgeo

Re: [R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

2012-11-15 Thread peleve
Thanks Robert, I was able to do it with the following using the 'gpclib" package: p2 <- as(xy, "gpc.poly") p1 <- as(maparea, "gpc.poly") plot(setdiff(p1, p2), poly.args = list(col = 3), add = TRUE) Did exactly what I was looking for. Pretty simple, actually. Thanks for inspiring me. Pete -

Re: [R-sig-Geo] Creating spatial lines in a loop

2012-11-15 Thread Michael Sumner
It is hard to help since your code is not reproducible, but there is a way to do this in the trip package with as.trip.SpatialLinesDataFrame, though going that route might be unattractive. Please provide the example data using something like dput(head(lid, n = 10)) rather than a straight dump like

Re: [R-sig-Geo] spml and logLik, help!

2012-11-15 Thread Ariel Ortiz-Bobea
After some digging, I realized the problem is that the log-likelihood is simply not exported by one of the internal functions (splm:::sperrorlm). To fix this simply modify that function. After loading splm type: fixInNamespace("sperrorlm", "splm") And manually add "ll=LL" as an element to the "r

[R-sig-Geo] Creating spatial lines in a loop

2012-11-15 Thread Aikens, Ellen
Hi, I have a csv containing animal movement data which is broken into different behavioral classes (under the heading line_id). I want to plot each of the trajectories as a spatial line segment. I am trying to do this in a loop, but I am running in to problems creating a list of Line objects. I

Re: [R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

2012-11-15 Thread Robert J. Hijmans
If you have a polygon for the entire area and one for the area of interest within it; then I think you could use rgeos::gDifference to create the polygon you need. Robert On Thu, Nov 15, 2012 at 6:19 AM, peleve wrote: > Thank you very much. That worked, mostly!?! But I see the methodology > n

Re: [R-sig-Geo] asc2dataframe and dataframe2asc problem with ncols nrows and cell size

2012-11-15 Thread Robert J. Hijmans
André, This looks like a bug. It would be appropriate to contact the author of the package to report this. To see the problem, there is no need for Notepad or similar, you can compare raster("d:/layer.asc") # with r # or dim(raster("d:/layer.asc")) dim(r) To work around it there are probably m

Re: [R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

2012-11-15 Thread peleve
Thank you very much. That worked, mostly!?! But I see the methodology now. I had been thinking about masks, but I was asking the wrong question I now realize. In my real application, using your approach, I still have some unwanted bits left outside of the polygon. I traced it as a left over piec

Re: [R-sig-Geo] asc2dataframe and dataframe2asc problem with ncols nrows and cell size

2012-11-15 Thread Proosdij, Andre van
Thanks Robert for your comments, Below the adjusted code which I tested for different extents of the study area. The problem seems to be with the dataframe2asc part. The ncols, nrows and cell size of the .asc files created should be identical, but they are not. Can anyone try the code and commen