[GRASS-user] Conversion from shapefile to GRASS and back

Hanlie Pretorius hanlie.pretorius at gmail.com
Wed Nov 10 09:57:08 EST 2010


Hi,

I've imported a shapefile with 14 polygons using v.in.ogr:
-----
v.in.ogr dsn=/media/0847147784/data/dwaf/liebenbergsvlei/myne/sa_tm_29_deg_east/C83A/c83a_14_subcatchments.shp
output=test
Datum <unknown> not recognised by GRASS and no parameters found
Projection of input dataset and current location appear to match
Layer: c83a_14_subcatchments
Importing map 14 features...
-----------------------------------------------------
Building topology for vector map <test>...
Registering primitives...
14 primitives registered
16578 vertices registered
Building areas...
7 areas built
4 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 9
Number of primitives: 14
Number of points: 0
Number of lines: 0
Number of boundaries: 14
Number of centroids: 0
Number of areas: 7
Number of isles: 4
Number of incorrect boundaries: 10
Number of areas without centroid: 7
-----------------------------------------------------
Cleaning polygons, result is not guaranteed!
Building topology for vector map <test>...
Number of nodes: 9
Number of primitives: 14
Number of points: 0
Number of lines: 0
Number of boundaries: 14
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
Break polygons:
-----------------------------------------------------
Remove duplicates:
-----------------------------------------------------
Break boundaries:
-----------------------------------------------------
Remove duplicates:
-----------------------------------------------------
Clean boundaries at nodes:
-----------------------------------------------------
Break boundaries:
-----------------------------------------------------
Remove duplicates:
-----------------------------------------------------
Clean boundaries at nodes:
-----------------------------------------------------
Change dangles to lines:
-----------------------------------------------------
Remove bridges:
-----------------------------------------------------
Building topology for vector map <test>...
Building areas...
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
308 areas built
13 isles built
Attaching islands...
Number of nodes: 1221
Number of primitives: 3277
Number of points: 0
Number of lines: 0
Number of boundaries: 3277
Number of centroids: 0
Number of areas: 308
Number of isles: 13
Number of incorrect boundaries: 17
Number of areas without centroid: 308
Cannot calculate area centroid
Cannot calculate area centroid
Layer: c83a_14_subcatchments
-----------------------------------------------------
-----------------------------------------------------
Building topology for vector map <test>...
Registering primitives...
   10001774 primitives registered
15588 vertices registered
Building areas...
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
Area of size = 0.0 ignored
308 areas built
13 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 1447
Number of primitives: 1774
Number of points: 0
Number of lines: 0
Number of boundaries: 1539
Number of centroids: 235
Number of areas: 308
Number of isles: 13
Number of incorrect boundaries: 17
Number of duplicate centroids: 29
Number of areas without centroid: 102
-----------------------------------------------------
196 areas represent more (overlapping) features, because polygons
overlap in input layer(s). Such areas are linked to more than 1 row in
attribute table. The number of features for those areas is stored as
category in layer 2
14 input polygons
Total area: 7.449545e+08 (308 areas)
Overlapping area: 2.001273e-05 (196 areas)
Area without category: 5.083098e-06 (71 areas)
(Wed Nov 10 16:45:27 2010) Command finished (11 sec)
-----

When I export the file to SHP again, it now contains 703 polygons:
-----
v.out.ogr -e input=test at PERMANENT type=area dsn=/home/hanlie/ olayer=test
The map contains islands. To preserve them in the output map, use the -c flag
Exporting 308 areas (may take some time)...
703 features written
102 features without category were written
(Wed Nov 10 16:47:55 2010) Command finished (0 sec)
-----

When I import and select not to clean the polygons upon import, I get:

-----
v.in.ogr -c dsn=/media/0847147784/data/dwaf/liebenbergsvlei/myne/sa_tm_29_deg_east/C83A/c83a_14_subcatchments.shp
output=test
Datum <unknown> not recognised by GRASS and no parameters found
Projection of input dataset and current location appear to match
Layer: c83a_14_subcatchments
Importing map 14 features...
-----------------------------------------------------
Building topology for vector map <test>...
Registering primitives...
28 primitives registered
16592 vertices registered
Building areas...
7 areas built
4 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 23
Number of primitives: 28
Number of points: 0
Number of lines: 0
Number of boundaries: 14
Number of centroids: 14
Number of areas: 7
Number of isles: 4
Number of incorrect boundaries: 10
Number of centroids outside area: 7
(Wed Nov 10 16:46:29 2010) Command finished (0 sec)
-----

But the GRASS vector layer has only 7 areas.

Does this indicate some flaw in my original data?

Thanks
Hnalie


More information about the grass-user mailing list