[GRASSLIST:9812] v.extract area with holes but without islands

I have a question about how to extract only a polygon and its holes from a
vector.

The background is that I have a shapefile from a colleague vectorised in
Arc from a raster showing a polygon with holes. The shapefile holes are
also clockwise (curiously), but I think that this is because the vector
shapes were not cleaned before outputting.

When read into GRASS 6 with v.in.ogr, the holes are recognised, but island
polygons are also created, type=area was used.

The same happens when I read the raster into GRASS and vectorise with
r.to.vect - creating the new vector makes one geometry of the external
boundary with holes, and then adds each hole again as an island as a
separate geometry, again type=area.

Finally, it happens again when I use v.extract on the geometry with holes:
the islands get built and added in, type=area.

Is there any way to remove the islands from the vector representation? The
output is to be used for spatial sampling, so sample points falling in the
holes should be discarded. I think v.build is assuming that holes should
be filled with islands in each case.

Roger

--
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@nhh.no

Dear Roger..
it could be I'm wrong but I think that island are automatically present
when you have a hole inside an area poligon...
grass dedects the island when it build topology.. it means that there is
an hole inside the poligon but you can simply verify that there is not a
centroid inside the island.... and this is correct because the island is
not an area (it has not attributes....)
instead the poligon has a centroid...

if you try to do the spatial sampling you will see that only points
falling in the area will be sampled, instead those falling in the island
(the hole) will be discared...

I hope this help...

ivan

Il giorno ven, 13/01/2006 alle 12.06 +0100, Roger Bivand ha scritto:

move the islands from the vector representation? The
output is to be used for spatial sampling, so sample points falling in
the
holes should be discarded. I think v.build is assuming that holes
should
be filled with islands in each case.

--
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
        ivan.marchesini@gmail.com
tel: +39(0)755853760
fax: +39(0)755853756

On Sat, 14 Jan 2006, ivan marchesini wrote:

Dear Roger..
it could be I'm wrong but I think that island are automatically present
when you have a hole inside an area poligon...
grass dedects the island when it build topology.. it means that there is
an hole inside the poligon but you can simply verify that there is not a
centroid inside the island.... and this is correct because the island is
not an area (it has not attributes....)
instead the poligon has a centroid...

Yes, I follow you so far.

if you try to do the spatial sampling you will see that only points
falling in the area will be sampled, instead those falling in the island
(the hole) will be discared...

But not if the vector is written out (for example as a shapefile of
type=area) and read into other software, in my case into R. But with
subsetting in R, it's easy to fix there, I just need to remember to find
the shape with the holes.

I hope this help...

Thanks,

Roger

ivan

Il giorno ven, 13/01/2006 alle 12.06 +0100, Roger Bivand ha scritto:
> move the islands from the vector representation? The
> output is to be used for spatial sampling, so sample points falling in
> the
> holes should be discarded. I think v.build is assuming that holes
> should
> be filled with islands in each case.

--
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@nhh.no

Hi,

Roger if you export the shape to a shapefile with v.out.ogr then if you
use the -c flag it will only export features with categories (i.e.
centroids, not the islands).

--Wolf

On 14/01/06 14:37, Roger Bivand wrote:

On Sat, 14 Jan 2006, ivan marchesini wrote:

But not if the vector is written out (for example as a shapefile of
type=area) and read into other software, in my case into R. But with
subsetting in R, it's easy to fix there, I just need to remember to find
the shape with the holes.

--

<:3 )---- Wolf Bergenheim ----( 8:>

On Sun, 15 Jan 2006, Wolf Bergenheim wrote:

Hi,

Roger if you export the shape to a shapefile with v.out.ogr then if you
use the -c flag it will only export features with categories (i.e.
centroids, not the islands).

Thanks - from:

r.to.vect input=tibriv1 output=tibriv2 feature=area
v.info tibriv2
# only one centroid
v.out.ogr -ce input=tibriv2 type=area dsn=. olayer=tibriv2cc
R

library(maptools)
sp1 <- readShapePoly("tibriv2cc.shp")
length(slot(sp1, "polygons"))

[1] 1

which is exactly what is needed!

Roger

--Wolf

On 14/01/06 14:37, Roger Bivand wrote:
> On Sat, 14 Jan 2006, ivan marchesini wrote:
>
>
> But not if the vector is written out (for example as a shapefile of
> type=area) and read into other software, in my case into R. But with
> subsetting in R, it's easy to fix there, I just need to remember to find
> the shape with the holes.
>

--
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@nhh.no