Hi all,
I imported a shape file into grass
v.in.ogr --o basel_gelaende.shp out=basel_gelaende
resulting in:
Number of nodes: 38602
Number of primitives: 115042
Number of points: 0
Number of lines: 0
Number of boundaries: 115042
Number of centroids: 0
Number of areas: 76441
Number of isles: 1
Number of areas without centroid: 76441
If I understood the grass book correctly, the table cat column and with
that the whole table is connected via the centroids. That would explain
that I don't see any information from the table when I use v.what:
Building spatial index...
East: 7:34:46.8228E
North: 47:34:23.9952N
Map: basel_gelaende
Mapset: Basel
Type: Area
Sq Meters: 32796.147
Hectares: 3.280
Acres: 8.104
Sq Miles: 0.0127
I could do a v.centroids to calculate the centroids and then also v.what
gives information from the table, but the data is not correct. I guess
grass put the cat values without really knowing the right connection.
It might be important that the map is actually a 3d one, but in "2d
mode" so I got the following warning:
WARNING: Input data contains 3D features. Created vector is 2D only, use
-z flag to import 3D vector
I can import the map in qgis and it works, I do have the right
connection between polygons and table rows. I tried to include
"centroid" in the type parameter of v.in.ogr, but this did not have any
effect for me.
Any idea?
Thanks a lot
Sebastian
Sebastian Schubert wrote:
Hi all,
I imported a shape file into grass
v.in.ogr --o basel_gelaende.shp out=basel_gelaende
resulting in:
Number of nodes: 38602
Number of primitives: 115042
Number of points: 0
Number of lines: 0
Number of boundaries: 115042
Number of centroids: 0
Number of areas: 76441
Number of isles: 1
Number of areas without centroid: 76441
What version of GRASS are you using? There are slight differences in
v.in.ogr between 6.4.0, 6.4.1, 6.4.2, although these should not affect
centroid creation. Are you using GRASS directly or through e.g. the
QGIS-GRASS plugin? And can you post the full output of v.in.ogr --v?
At some stage, centroids are calculated for input polygons, and the
corresponding messages would be helpful.
I could do a v.centroids to calculate the centroids and then also v.what
gives information from the table, but the data is not correct. I guess
grass put the cat values without really knowing the right connection.
Yes, this must be determined during import.
It might be important that the map is actually a 3d one, but in "2d
mode" so I got the following warning:
WARNING: Input data contains 3D features. Created vector is 2D only, use
-z flag to import 3D vector
No, this should not affect the output. Unless the input shapefile is
real 3D with vertical polygons that have zero area size when projected
onto the x,y plane. 2.5D polygons are fine.
Markus M
On 18/10/11 17:37, Markus Metz wrote:
Sebastian Schubert wrote:
Hi all,
I imported a shape file into grass
v.in.ogr --o basel_gelaende.shp out=basel_gelaende
resulting in:
Number of nodes: 38602
Number of primitives: 115042
Number of points: 0
Number of lines: 0
Number of boundaries: 115042
Number of centroids: 0
Number of areas: 76441
Number of isles: 1
Number of areas without centroid: 76441
What version of GRASS are you using? There are slight differences in
v.in.ogr between 6.4.0, 6.4.1, 6.4.2, although these should not affect
centroid creation.
6.4.1
Are you using GRASS directly or through e.g. the
QGIS-GRASS plugin?
Directly.
And can you post the full output of v.in.ogr --v?
This is the output for the shape filed attached:
GRASS 6.4.1 (WGS84):~/temp/basel > v.in.ogr --v polygon.shp out=polygon
Projection of input dataset and current location appear to match
Using temporary vector <polygon_tmp>
Layer: polygon
Counting polygons for 1 features...
Importing map 1 features...
100%
-----------------------------------------------------
Building topology for vector map <polygon_tmp>...
Registering primitives...
1 primitives registered
4 vertices registered
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
WARNING: Cleaning polygons, result is not guaranteed!
-----------------------------------------------------
Break polygons:
100%
100%
-----------------------------------------------------
Remove duplicates:
100%
-----------------------------------------------------
Break boundaries:
100%
Intersections: 0
-----------------------------------------------------
Remove duplicates:
100%
-----------------------------------------------------
Clean boundaries at nodes:
-----------------------------------------------------
Change dangles to lines:
100%
-----------------------------------------------------
Remove bridges:
100%
-----------------------------------------------------
Merge boundaries:
100%
0 boundaries merged
0 new boundaries
-----------------------------------------------------
Building topology for vector map <polygon_tmp>...
Building areas...
100%
1 areas built
1 isles built
Attaching islands...
100%
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: 1
Number of isles: 1
Number of areas without centroid: 1
-----------------------------------------------------
Find centroids for layer: polygon
-----------------------------------------------------
Write centroids:
100%
-----------------------------------------------------
1 input polygons
Total area: 19263.4 (1 areas)
Overlapping area: 0 (0 areas)
Area without category: 19263.4 (1 areas)
-----------------------------------------------------
Building topology for vector map <polygon>...
Registering primitives...
1 primitives registered
4 vertices registered
Building areas...
100%
1 areas built
1 isles built
Attaching islands...
100%
Attaching centroids...
100%
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: 1
Number of isles: 1
Number of areas without centroid: 1
WARNING: Input data contains 3D features. Created vector is 2D only, use -z
flag to import 3D vector
Similar problem.
I used Qgis to just keep one polygon. In Qgis, I can see the connected
table with the values "OBJID", "ART", "ART_TXT", "Z_MIN", "Z_MAX",
"Z_MEAN", "LENGTH_3D", "MIN_SLOPE", "MAX_SLOPE", "AVG_SLOPE", "VERTEX_CNT".
Thanks!
Sebastian
(attachments)
polygon.zip (1.43 KB)
On Tue, Oct 18, 2011 at 7:38 PM, Sebastian Schubert
<schubert.seb@googlemail.com> wrote:
On 18/10/11 17:37, Markus Metz wrote:
Sebastian Schubert wrote:
Hi all,
I imported a shape file into grass
v.in.ogr --o basel_gelaende.shp out=basel_gelaende
resulting in:
Number of nodes: 38602
Number of primitives: 115042
Number of points: 0
Number of lines: 0
Number of boundaries: 115042
Number of centroids: 0
Number of areas: 76441
Number of isles: 1
Number of areas without centroid: 76441
What version of GRASS are you using? There are slight differences in
v.in.ogr between 6.4.0, 6.4.1, 6.4.2, although these should not affect
centroid creation.
6.4.1
Are you using GRASS directly or through e.g. the
QGIS-GRASS plugin?
Directly.
And can you post the full output of v.in.ogr --v?
This is the output for the shape filed attached:
GRASS 6.4.1 (WGS84):~/temp/basel > v.in.ogr --v polygon.shp out=polygon
Projection of input dataset and current location appear to match
Using temporary vector <polygon_tmp>
Layer: polygon
Counting polygons for 1 features...
Importing map 1 features...
100%
-----------------------------------------------------
Building topology for vector map <polygon_tmp>...
Registering primitives...
1 primitives registered
4 vertices registered
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: -
Number of isles: -
-----------------------------------------------------
WARNING: Cleaning polygons, result is not guaranteed!
-----------------------------------------------------
Break polygons:
100%
100%
-----------------------------------------------------
Remove duplicates:
100%
-----------------------------------------------------
Break boundaries:
100%
Intersections: 0
-----------------------------------------------------
Remove duplicates:
100%
-----------------------------------------------------
Clean boundaries at nodes:
-----------------------------------------------------
Change dangles to lines:
100%
-----------------------------------------------------
Remove bridges:
100%
-----------------------------------------------------
Merge boundaries:
100%
0 boundaries merged
0 new boundaries
-----------------------------------------------------
Building topology for vector map <polygon_tmp>...
Building areas...
100%
1 areas built
1 isles built
Attaching islands...
100%
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: 1
Number of isles: 1
Number of areas without centroid: 1
-----------------------------------------------------
Find centroids for layer: polygon
-----------------------------------------------------
Write centroids:
100%
-----------------------------------------------------
1 input polygons
Total area: 19263.4 (1 areas)
Overlapping area: 0 (0 areas)
Area without category: 19263.4 (1 areas)
-----------------------------------------------------
Building topology for vector map <polygon>...
Registering primitives...
1 primitives registered
4 vertices registered
Building areas...
100%
1 areas built
1 isles built
Attaching islands...
100%
Attaching centroids...
100%
Topology was built
Number of nodes: 1
Number of primitives: 1
Number of points: 0
Number of lines: 0
Number of boundaries: 1
Number of centroids: 0
Number of areas: 1
Number of isles: 1
Number of areas without centroid: 1
WARNING: Input data contains 3D features. Created vector is 2D only, use -z
flag to import 3D vector
Similar problem.
Thanks for the sample polygon. I could reproduce it, have found the
bug and fixed it in r48850-2 (all branches).
Markus M
On Wednesday 19 October 2011 08:51:35 Markus Metz wrote:
[no centroids when importing]
Thanks for the sample polygon. I could reproduce it, have found the
bug and fixed it in r48850-2 (all branches).
Thanks a lot for this very fast fix. It works for me!
Sebastian