Hi,

I have a larger map that I want to clip using a another map. I found this code on geo mailing list and it works and clips the map properly by the data layer is lost.  The code is below. 
{
cz_zip <- gIntersects(camapzip_temp,camap_base, byid=TRUE) 
out <- lapply( which(cz_zip) , function(x){ gIntersection( camapzip_temp[x,] , camap_base ) } )
keep <- sapply(out, class)
out <- out[keep == "SpatialPolygons"]
czout <- SpatialPolygons( lapply( 1:length( out ) , function(i) { Pol <- slot(out[[i]], "polygons")[[1]];   slot(Pol, "ID") <- as.character(i)
                                                                   Pol}))
}

When I run the command: slotNames(czout)

I get: [1] "polygons"    "plotOrder"   "bbox"        "proj4string"

I don't know what happened to the "data" layer which is normally there? I need the data layer to merge another text file with. I should be able to merge by accessing  "czout@data" but this is somehow lost in the process above.

Any help would be appreciated.

Ravi




 		 	   		  
	[[alternative HTML version deleted]]

