[R] Calculating area of polygons created from a spatial intersect

MacQueen, Don macqueen1 at llnl.gov
Fri Mar 27 18:44:58 CET 2015


Suggest (strongly) that you move this question to r-sig-geo. Much more
appropriate there, and more people there are more familiar with this kind
of work. But ... I suspect you want gIntersection(), not gIntersects().

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/27/15, 7:16 AM, "Walter Anderson" <wandrson01 at gmail.com> wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hello all,
>
>I am attempting to automate an analysis that I developed with ArcInfo
>using R and the gdal and geos packages (or any other) if possible.
>
>Here is the basic process
>
>I have a shape file (lines) that defines the limits of all of the
>projects with each project having a unique identifier.
>
>I have another shape file (polys) that contains total population and
>low income population and represent Census block groups.  This shape
>file has an area field which has the acreage of the total block group.
>
>Process
>
>Step 1.
>I then buffer these project lines to create a second shape file that
>represents the 'footprint' of the project. (Creates polys).
>
>Step 2.
>In ArcInfo, I perform an intersection of the two shape files
>(footprint and census blocks) and this creates a third shape file
>which has a unique polygon for every project/census block intersection.
>
>Step 3.
>I then perform an area calculation (acres) on this new poly shape file
>and use this calculated area divided by the original area of the
>associated census block group to apportion the two population datum to
>this new polygon.
>
>Step 4.
>Finally, I sum the two population datums for each of the projects from
>the attribute table of this final shape file.
>
>When I try to replicate the above procedure I run into a problem with
>Step 2 when I use what I think is the appropriate command:
>
>gIntersects(buffered_projects, census_blocks, byID=TRUE)
>
>This command is producing a matrix of each project/census block
>combination and only providing me a true/false indication.  Is there
>any way to replicate the process from ArcInfo that I outlined above
>within R?
>
>Walter Anderson
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1
>
>iQIcBAEBAgAGBQJVFWYWAAoJEHfnxjvhypCiMc8P/2Dsja+h4RKuR7ygHx+oI+4/
>oEIxl/NtnHwPh6szyL6CBndSYI6hvdWWwBUm86IsJLmLSSFivB1Ru54nkFq+kfKL
>tWpxyOAXNZoa2xn1ADaG1ChFiY/hF937zlTTv8D3a5pYAnYtTeyg6UJ3AuHsfjqG
>PbFAg6T+QD3AlJvV73JGmEchgYoj7NlxiEmdcfB3X9cgLMMOCsfLgm4d5g5J/mhh
>LKZm3Xg9+eXEjPJazHYB9xc0+AF8Jp6SH9XnnZ/DMFN3DuyR3KuTJr6YnHUKvtUs
>o/Uog3zAGuVUDqNwF1H9+WNuz4Fm7XXiHl4xX0n9faE3niTe2b63bVn/Ueiyofb9
>ky3wIpAr412/Ne3dtMtSDPkE3w2TsdIUKki2VP9duXB/4vEtHHXvQxNtfKdKmlYX
>cnyyK/1ZwULiwWhyxZKJNUd6N2GyLYJ8MmJ7AXnT7EboJjNkhNta1BhWBE9Kzx8p
>fUN1UwS8P96iFXztgg2jw3aYTPdPIp9rFYFJax5nKCl6n+YbjUw11GuO6F4lqNDv
>PoLllcKkmsGWFo04P0TbS+x1zhc0wmyMn2EV8FcIXJ/80pqT/dWwksbjTfrQGoWx
>Xo1m1vTR2LVVrdf0vSkWnxHA3xVQPv7YH5erVNBGWvuhgbLRx8j7MPUp7lFHOJvQ
>bq1VJbpnZFRvJyZfII2p
>=cZWI
>-----END PGP SIGNATURE-----
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list