Merging SpatialPolygonsDataFrame and SpatialLinesDataFrame
Hi, You might also want to look into the links between Grass and R and SAGA and R. This link enables you to use the GIS functionality of these programs from R, I'm fairly certain that this includes the functionality your requested. cheers, Paul
Jim Burke wrote:
Hi everyone, Been scratching my head on this. A common operation. Google seems to be mute on this, so I turn to you. I have a nice SpatialPolygonsDataFrame that I can plot with wonderful colors using spplot. I would like to 1. MERGE SpatialLinesDataFrame (PolyLine) over the SpatialPolygonsDataFrame (Polygons). And plot with spplot(). 2. CLIP the PolyLine to the area of the Polygons. The polygons are within the larger main_main roads Polyline 3. COLOR PolyLine main_roads different than black for example; white or gray. NOTES. FILE READS ARE BELOW
tx3_sp <- readShapePoly("tx3_sp.shp", IDvar="PCT",
proj4string=CRS("+proj=aea +ellps=GRS80 +datum=WGS84"),
verbose=TRUE, repair=FALSE)
Shapefile type: Polygon, (5), # of Shapes: 39
main_roads <-readShapeLines("main roads.shp",
proj4string=CRS("+proj=aea +ellps=GRS80 +datum=WGS84"),
verbose=TRUE,repair=FALSE)
Shapefile type: PolyLine, (3), # of Shapes: 29161
class(tx3_sp)
[1] "SpatialPolygonsDataFrame" attr(,"package") [1] "sp"
class(main_roads)
[1] "SpatialLinesDataFrame" attr(,"package") [1] "sp" Thanks and I am grateful for all thoughts and assistance, Jim Burke
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul