Skip to content

Close Spatial Lines into a Polygon

2 messages · Rodrigo Aluizio, Roger Bivand

#
Hi Sig list, I?m really new representing spatial data, but I?m already able
to create excellent maps using sp, maptools and mapdata packages. 

Anyway, I have a SpatialLines object (attached) which I would like to
?close? and turn it into a SpatialPolygon, so I can fill it with a color.
The object already posses some closed lines (islands) but the entire area is
wide open.  To make things easier it could be closed at the ocean side
(right side, if plotted), so there will be no need to deal with the open and
closed areas. This ?closure? may be done as the coast line was and
hypotenuse of a rectangular triangle.

 

Is there a way to do so? I was looking for something similar to that in the
R site search, but I didn?t found a total match with my issue, or maybe I?m
too new to that, so I wasn?t even able to recognize a solution J.

 

Thank you for your attention and sorry if the question was already answered.

 

-------------------------------------------------------------

MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio

Centro de Estudos do Mar/UFPR
Laborat?rio de Micropaleontologia



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20091230/c896dd61/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BP.Rdata
Type: application/octet-stream
Size: 39731 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20091230/c896dd61/attachment.obj>
#
On Wed, 30 Dec 2009, Rodrigo Aluizio wrote:

            
The general answer is in chunks 66 and 71 in the code from our book, see:

http://www.asdar-book.org/book/cm_mod.R

That leaves one small unclosed island in the NE, plus the coastline. If 
you want to colour the land, you need to close these two manually to the 
E, N, and S bounding box values, and something extra to the west, probably 
by extracting and re-inserting the coords slots of the two "Line" objects.

Hope this helps,

Roger