[GRASS-dev] some question about GRASS vectors

Markus Metz markus.metz.giswork at gmail.com
Thu May 19 14:01:57 PDT 2016


On Thu, May 19, 2016 at 4:48 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> 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.

A line or boundary consisting of only one point does not make sense
but it is technically possible. They can be removed with v.clean
tool=rmline

>
> 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.

That is correct. In OGR, a multipolygon is a single geometry object,
and all polygons in that object have the same attributes. This feature
is preserved when importing into GRASS: all objects in the same
multi-geometry object have the same attributes.

>From a topological perspective, the split of the self-intersection
into two areas is also correct.

Markus M

>
> Moritz
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list