wps/src/main/webapp/R/scripts/geo_poly-intersection.R

19 lines
493 B
R
Executable File

# Author: Matthias Hinz
###############################################################################
# wps.des: geo.poly.intersection;
# wps.in: r1, shp_x, Polygon1;
# wps.in: r2, shp_x, Polygon2;
library(rgeos); library(maptools); library(rgdal);
poly1 = readShapePoly(r1)
poly2 = readShapePoly(r2)
polyint = gIntersection(poly1,poly2)
poly = as(polyint,"SpatialPolygonsDataFrame")
out="out.shp"
writeOGR(poly,out,"data","ESRI Shapefile")
# wps.out: out, shp_x, Intersection Polygon;