[GRASS-dev] some question about GRASS vectors

Moritz Lennert mlennert at club.worldonline.be
Thu May 19 07:48:59 PDT 2016


On 18/05/16 16:37, Luca Delucchi wrote:
> Hi devs,
>
> I'm working on a QGIS plugin to check the differences between an input
> shapefile and the resulting GRASS vector. I have some doubts:
> - a line with only a point is a valid line? I was thinking it should
> not be valid but GRASS doesn't return any error

No error at what operation ?

I can import with v.in.ogr, just as I can open it with QGIS.

But, yes, GRASS does import a one-point line. You can confirm this with

echo "L 1 1
   100.0 0.0
   1 1" | v.in.ascii in=- out=line format=standard -n

Whether this is good or bad is open to discussion.

The programmer's manual states:

line: a directed sequence of connected vertices with two endpoints 
called nodes (2D or 3D) - GV_LINE

But it doesn't say that the two nodes can't be identical. AFAIU, the 
vector format is essentially points stored in the coor file with 
additional information about what type of feature each point belongs to. 
GRASS doesn't really care about how many points are there.

You can even import a boundary with only one point. You will get a 
warning at topology build time that the boundary is incorrect, but this 
is only a warning, not an error...

> - is it correct that attributes for multipolygon or polygon with self
> intersection (so GRASS creates two different areas) are not imported?

No. Importing your two files with v.in.ogr I get two polygons, both with 
the same category value and this points to an attribute table that 
contains the attribute.

Moritz


More information about the grass-dev mailing list