[R-sig-Geo] Defining Holes Inside a Polygon

Roger Bivand Roger.Bivand at nhh.no
Fri Nov 5 11:01:05 CET 2010


On Fri, 5 Nov 2010, Rodrigo Aluizio wrote:

> Hi List.
>
> I?m trying to solve an issue here, but it?s getting tricky.
>
> I have an MapGen .dat file (attached) that contains about 39 closed lines.
> Three of them (the largest ones) will be my main polygons and the rest of
> them must become holes inside one of the three major areas. I?m able to
> transform all the closed lines into SpatialPolygons and even create
> shapefiles with them, but how can I modify the ?hole? slot of the smaller
> polygons so I can keep them transparent when overlaying another map (those
> holes will overlay islands of a raster image)?
>

Next time avoid sending 200K to over 1700 people, please, we have a planet 
to protect! Put any desired attachments on a website and provide a link.

You should also have provided the code (in your message) to get from:

library(maptools)
l1 <- MapGen2SL("PCForams.dat")

to your problem - as those choices may be the cause of the problem; you 
have not provided the output of sessionInfo() either. Once things are 
lined up, you should - if you may - say:

gpclibPermit() # very restrictive license
pls_out <- lapply(slot(SpPols0, "polygons"), checkPolygonsHoles)
SpPols1 <- SpatialPolygons(pls_out)

Or if you can install rgeos from source on R-Forge, equivalently:

library(rgeos)
SpPols1 <- createSPComment(SpPols0)

Hope this helps,

Roger

>
>
> Thank you for the attention and help.
>
> Regards.
>
>
>
> -------------------------------------------------------------------
>
> MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio
>
> Centro de Estudos do Mar/UFPR
> Laboratório de Foraminíferos e Micropaleontologia Ambiental
> Avenida Beira Mar s/n - CEP 83255-971
> Pontal do Paraná - PR - Brazil
>
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list