Satish,

Here are some suggestions:

library(rgeos)
library(raster)
# you need the latests versions of the above packages
library(rgdal)

grid <- readOGR("c:/satish", "Gaussian_Poylgon_ExtendedCONUS")
clim <- readOGR("c:/satish", "US344ClimateDivisions")

# climag has several polygons with the same attributes
# you should probably "aggregate" first
climag <- aggregate(clim, 'Name')

#rather than creating a polygon grid, I would create a raster grid
# raster(xmn=, , , , ) etc.
# for now this recreates your polygon grid as a raster
r <- raster(grid)
dim(r) <- c(38, 92)
r[] <- 1:ncell(r)

ex <- extract(r, climag, weights=TRUE)
ex[1]
sapply(ex, nrow)  # each multi-polygon has at least one cell

# you would be able to compute area were it not that this is lon/lat data.
# either first project your data, or use a function like 'area' to
determine the area of each grid cell
# and then take the fractions from "ex"

#This fails
x <- gIntersection(grid, climag, byid=TRUE)

# but you can do this for most polygons

x <- gIntersection(grid, climag[1,])
plot(x)
row.names(x)
sapply(x@polygons, function(x) slot(x, 'area'))

# and that is more precise than the raster method

Hope this helps, Robert

On Thu, Dec 22, 2011 at 1:54 PM, satishr <satish.regonda@gmail.com> wrote:

> Robert,
>   Thanks for the information. I am also not sure whether rasterizing a
> rectangular grid is good or not. I tried 'gIntersection' but got an error.
> Anyway, here are the data sets. As you see the climate division file name
> changed, so you may want to change the name in the code.
> Thanks,
> Satish
>
> 1. Rectangular Gaussian Grid
>
> http://r-sig-geo.2731867.n2.nabble.com/file/n7120086/GaussianPolygonExtendedCONUS.zip
> GaussianPolygonExtendedCONUS.zip
>
>
> 2. US climate divisions
>
>
> http://r-sig-geo.2731867.n2.nabble.com/file/n7120086/US344ClimateDivisions.zip
> US344ClimateDivisions.zip
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/Re-calculate-fraction-of-a-polygon-that-is-intersected-by-another-polygon-tp7119738p7120086.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

