search for: asafaneh

Displaying 6 results from an estimated 6 matches for "asafaneh".

2017 Sep 26
0
build a SpatialLines object from a list
...the list and only at the end supply that to the SpatialLines function, something like test.func <- function(x) { tt <- list() for ( i in ... ) { ... tt[[i]] <- (whatever) } return(SpatialLines(tt)) } Eric On Tue, Sep 26, 2017 at 12:36 PM, Ashraf Afana <asafaneh at yahoo.com> wrote: > Hi Eric, > > Thanks for the help.But this will not solve the problem as it will > generate a list and what I need is an object of class sp using SpatialLine > function from sp package.So, I need to convert each matrix to coordinates > and then to a line...
2017 Sep 25
0
build a SpatialLines object from a list
Hi Ashraf, It is not obvious to me what your structures are but one problem in your function is the assignment tt1 <- SpatialLines(list(tt[[i]])). This will set tt1 to just have one item. Consider the following test.func <- function(x) { tt1 <- list() for ( i in ... ) { ... tt1[[i]] <- SpatialLines(tt[[i]]) } return(tt1) } HTH, Eric On Mon, Sep 25,
2017 Sep 26
2
build a SpatialLines object from a list
Hi Eric, Thanks for the help.But this will not solve the problem as it will generate a list and what I need is an object of class sp using SpatialLine function from sp package.So, I need to convert each matrix to coordinates and then to a line and then to a spatial line as figured in the code. My data structure is a list of 141 matrices.Each matrix represents coordinates of the river lines
2017 Oct 11
1
Iterate in a Spatial Polygon Dataframe in R?
Hi all, ?I'm trying to iterate in a SpatialPolygonDataFrame thatcontains 110 features. I tried to use the following code? iterate.spdf =function(x){ for (i in 1:nrow(x)){ p = x[i, ]} return(p)} but with no success as it returns with aSpatialPolygonDataFrame that contains onlyone feature. The code seems to overwrite the polygons to end up with only onefeature. ?Any suggestions?Ashraf, cheers
2017 Sep 25
2
build a SpatialLines object from a list
Hi all,I'm trying to build a SpatialLines object from a list that contains 124 river segments. Each segment in the list contains the x,y coordinates. I'm using the following code to create the SpatialLines object, but it just retrieves one segment. Any suggestions? test.func = function(x){ ??? for (i in 1:length(x)) {??????? tt[[i]] <- x[i]; tt[[i]]? = Line(tt[[i]]); tt[[i]]? =
2017 Nov 15
1
Rasterize function with maximum in R
Hi all, I have some concerns regarding the rasterize option in R and I would like to know if the fun=max in rasterize in R provides similar results to the one achieved by using "Polygon to Raster using maximum-combined-area" in ArcGIS? I'm trying to rasterize a habitat layer to a raster of 10m spatial resolution using the function 'max' (e.g. r <- rasterize(ht, r,