Hi,

If you want to clip your contour lines with your estuary, you can use
rgeos::gIntersection.


2013/1/19 jdbaba <janesh.devkota@gmail.com>

> Hello All,
>
> I am a new user in R and am trying hard to have a understanding in R and
> mapping techniques.
>
> I have an estuary shapefile and then I have data points with x,yand z
> coordinates. I want to show the contour lines on the shapefile.
>
> The procedure I used is using akima package to do the interpolation. The
> code I used to interpolate is
>
> fld <- interp(x,y,z)
>
> Then I changed this to spatial object by using following code:
>
> res <-ContourLines2SLDF(contourLines(fld))
>
> The above command would store the contourlines as spatial data.
>
> Then I read the shapefile and I plot both shapefile and res as follows:
>
> p1 <-
>
> spplot(hello,sp.layout=list(list("sp.lines",res)),col="blue",lwd=0,fill="grey",colorkey=F)
> p1
>
> "hello" is my shapefile and "res" is the object I created as shown above.
>
> The problem is contour stored is "res" extends beyound the shapefile. So I
> want to clip that contour with the shapefile and only display the contour
> within the shapefile area.
>
>
>
> I have attached the image I got with my code.
> <
> http://r-sig-geo.2731867.n2.nabble.com/file/n7582339/shapefile_with_contour.png
> >
>
>
> In the image you can see the lines out of the shapefile. I also want to
> know
> how can I display the contour levels on the map.
>
> Thank you so much.
>
> Jdbaba
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/How-to-clip-the-object-created-by-Conourlines2SLDF-with-polygon-tp7582339.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]]

