[GRASS-user] confused by the GRASS Programmer's topology examples...

Hi all,
I’m reading the GRASS7 programmer’s manual, to update my experience with GRASS (I’m going to use it for some network analysis, and probably I will need to extend it)
Looking at the topology examples [1] I fill a bit confused by the “types” of nodes and lines, which vary between the different kind of topological structures.

  • Point example: a point doesn’t have nodes but have a line (P_LINE), with type GV_POINT.
    It’s enough for me to get confused :slight_smile:
    A P_LINE structure has a void * topo opaque element [2], which will point to the relative topology structure depending on the type. In case of a G_POINT type, what is the topology structure attached to the topo pointer?

  • Line example: two nodes with type GV_LINE. A P_NODE doesn’t have a type [3], so how can it be… a GV_LINE? :frowning:

I’m missing something. Could you help to understand it?
Thanks a lot,
giovanni

[1] http://grass.osgeo.org/programming7/vlibTopology.html#vlibTopoExamples
[2] http://grass.osgeo.org/programming7/structP__line.html
[3] http://grass.osgeo.org/programming7/structP__node.html


Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus

Going on grasping the data structures…

  • Point example: a point doesn’t have nodes but have a line (P_LINE), with type GV_POINT.
    It’s enough for me to get confused :slight_smile:
    A P_LINE structure has a void * topo opaque element [2], which will point to the relative topology structure depending on the type. In case of a G_POINT type, what is the topology structure attached to the topo pointer?

Ok, as I supposed the topo pointer is NULL for points.

  • Line example: two nodes with type GV_LINE. A P_NODE doesn’t have a type [3], so how can it be… a GV_LINE? :frowning:

Sorry, this is clear now. The type is referring to the lines attached to the node.

I’m missing something. Could you help to understand it?
Thanks a lot,
giovanni

[1] http://grass.osgeo.org/programming7/vlibTopology.html#vlibTopoExamples
[2] http://grass.osgeo.org/programming7/structP__line.html
[3] http://grass.osgeo.org/programming7/structP__node.html


Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus


Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus

On Thu, Apr 11, 2013 at 11:32 AM, G. Allegri <giohappy@gmail.com> wrote:

Hi all,
I'm reading the GRASS7 programmer's manual, to update my experience with
GRASS (I'm going to use it for some network analysis, and probably I will
need to extend it)

You would need to read the programmer's manual only if you want to
develop GRASS. The user manual should explain everything needed to use
GRASS.

Looking at the topology examples [1] I fill a bit confused by the "types" of
nodes and lines, which vary between the different kind of topological
structures.

- Point example: a point doesn't have nodes but have a line (P_LINE), with
type GV_POINT.
It's enough for me to get confused :slight_smile:

A point (GV_POINT) is not attached to nodes (in GRASS 7). P_line is an
internal structure that holds information about points, lines,
boundaries, centroids, faces. Or in your words, a structure P_line
does not hold information about nodes if it is of type GV_POINT.

A P_LINE structure has a void * topo opaque element [2], which will point to
the relative topology structure depending on the type. In case of a G_POINT
type, what is the topology structure attached to the topo pointer?

- Line example: two nodes with type GV_LINE. A P_NODE doesn't have a type
[3], so how can it be... a GV_LINE? :frowning:

It seems you are mixing internal structures (P_line, P_node) and
feature types (GV_POINT, GV_LINE, GV_BOUNDARY, GV_CENTROID, GV_FACE).
In the example, there is one line (GV_LINE), and the end points of the
line are attached to nodes. Two end points -> two nodes, if the end
points are different. The "type = 2 (GV_LINE)" in the example for the
node refers to the feature type attached to the node.

Markus M

I'm missing something. Could you help to understand it?
Thanks a lot,
giovanni

[1] http://grass.osgeo.org/programming7/vlibTopology.html#vlibTopoExamples
[2] http://grass.osgeo.org/programming7/structP__line.html
[3] http://grass.osgeo.org/programming7/structP__node.html

--
Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Thanks very much for the clear explanation.
As I wrote in my self-reply, and as you have highlitghted, I was mixing some concepts.
I’m studying this because I will probably need to develop some routines for network analysis. I’m studying the graph structure right now…

Thanks again,
Giovanni

2013/4/12 Markus Metz <markus.metz.giswork@gmail.com>

On Thu, Apr 11, 2013 at 11:32 AM, G. Allegri <giohappy@gmail.com> wrote:

Hi all,
I’m reading the GRASS7 programmer’s manual, to update my experience with
GRASS (I’m going to use it for some network analysis, and probably I will
need to extend it)

You would need to read the programmer’s manual only if you want to
develop GRASS. The user manual should explain everything needed to use
GRASS.

Looking at the topology examples [1] I fill a bit confused by the “types” of
nodes and lines, which vary between the different kind of topological
structures.

  • Point example: a point doesn’t have nodes but have a line (P_LINE), with
    type GV_POINT.
    It’s enough for me to get confused :slight_smile:

A point (GV_POINT) is not attached to nodes (in GRASS 7). P_line is an
internal structure that holds information about points, lines,
boundaries, centroids, faces. Or in your words, a structure P_line
does not hold information about nodes if it is of type GV_POINT.

A P_LINE structure has a void * topo opaque element [2], which will point to
the relative topology structure depending on the type. In case of a G_POINT
type, what is the topology structure attached to the topo pointer?

  • Line example: two nodes with type GV_LINE. A P_NODE doesn’t have a type
    [3], so how can it be… a GV_LINE? :frowning:

It seems you are mixing internal structures (P_line, P_node) and
feature types (GV_POINT, GV_LINE, GV_BOUNDARY, GV_CENTROID, GV_FACE).
In the example, there is one line (GV_LINE), and the end points of the
line are attached to nodes. Two end points → two nodes, if the end
points are different. The “type = 2 (GV_LINE)” in the example for the
node refers to the feature type attached to the node.

Markus M

I’m missing something. Could you help to understand it?
Thanks a lot,
giovanni

[1] http://grass.osgeo.org/programming7/vlibTopology.html#vlibTopoExamples
[2] http://grass.osgeo.org/programming7/structP__line.html
[3] http://grass.osgeo.org/programming7/structP__node.html


Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus