[R-sig-Geo] Calculating the length of a line created from a spatial intersect.

Walter Anderson wandrson01 at gmail.com
Wed Apr 1 17:18:56 CEST 2015


Hello all,

I am continuing on the process of automating an analysis that I
developed with ArcInfo using R with the sp, rgdal, rgeos, and raster
libraries.

This step is similiar to my previous question concerning calculating the
area of a polygon created from a spatial intersect; however, the command
I was referred doesn't perform the merge of the two data frames as it
does when both spatial data sets are polygons.

Here is the process I am using in ArcInfo that I need to replicate:

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 (lines) that represent the road centerlines
and have a traffic volumen associated with each link.

Process
Step 1.
I then buffer these project lines to create a second shape file that
represents the 'footprint' of the project. (Creates polys).  This is a
small footprint (250 ft) that is solely used to associate the
appropriate portion of any adjacent roadways.  Mostly to accomodate
spatial errors...

Step 2.
In ArcInfo, I perform an intersection of the two shape files
(footprint and roadway centerlines) and this creates a third shape file
which has a unique line for every project buffer/roadway intersection.
This attribute table contains the attributes from both original shape files

Step 3.
I then perform a calculation that provides a weighted volume to
associate with each project.  The weighting is based upon the lengths of
the road segments that are 'cut' by the project in relation to their
original lengths.

My issue is that I have not found a method to 'intersect' the two
spatial data sets and retain both of their attributes (and calculate new
lengths).

Walter Anderson



More information about the R-sig-Geo mailing list