Displaying centroids of polylines

714 views
Skip to first unread message

nicholas....@tmr.qld.gov.au

unread,
Oct 28, 2010, 8:00:55 PM10/28/10
to mapi...@googlegroups.com

Hi all,

I am using MapInfo 9.5

I have a dataset of polylines and I want to display the centroids.

When I use the display options to choose to display the centroids, there is no change to the display?

Regards,
Nick


***********************************************************************
WARNING: This email (including any attachments) may contain legally
privileged, confidential or private information and may be protected by
copyright. You may only use it if you are the person(s) it was
intended to be sent to and if you use it in an authorised way. No one
is allowed to use, review, alter, transmit, disclose, distribute, print
or copy this email without appropriate authority.

If this email was not intended for you and was sent to you by mistake,
please telephone or email me immediately, destroy any hardcopies of
this email and delete it and any copies of it from your computer
system. Any right which the sender may have under copyright law, and
any legal privilege and confidentiality attached to this email is not
waived or destroyed by that mistake.

It is your responsibility to ensure that this email does not contain
and is not affected by computer viruses, defects or interference by
third parties or replication problems (including incompatibility with
your computer system).

Opinions contained in this email do not necessarily reflect the
opinions of the Department of Transport and Main Roads,
Maritime Safety Queensland or endorsed organisations utilising
the same infrastructure.
***********************************************************************

 

Jan S

unread,
Oct 29, 2010, 1:35:43 AM10/29/10
to MapInfo-L
Nick,
It is my understanding that Polylines have NODEs and not Centroids.
If I tick Centroids on the 'Roads' layer (polylines) no symbols
change, but nodes show all nodes (points) along the line

Jan

Geomap

unread,
Oct 29, 2010, 1:55:57 AM10/29/10
to MapInfo-L
One workaround is to generate a thematic map using point ranges from
an attribute attached to the line object. The generated point will be
at the centroid of the line.

Peter Horsbøll Møller

unread,
Oct 29, 2010, 2:25:56 AM10/29/10
to mapi...@googlegroups.com
Nick,
Turn on the line direction and you will see an arrow where the centroid is

Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo


--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

Uffe Kousgaard

unread,
Oct 29, 2010, 2:52:55 AM10/29/10
to mapi...@googlegroups.com
Hi Peter,

There seems to be 2 kind of centroids:

1) When there is an even number of nodes ( = uneven number of arcs)
This will put the arrow halfway on the mid-arc

2) When there is an uneven number of nodes ( = even number of arcs)
This will put the arrow halfway on the arc before the mid-node

If you update the table with obj = centroid(obj), the new point is now the same in situation 1), but for 2) the point is on the mid-node, i.e. different.

A more "true" centroid would be halfway down the whole polyline. MapInfo do not support that.

Regards
Uffe Kousgaard

Eric Blasenheim

unread,
Oct 29, 2010, 6:14:48 PM10/29/10
to MapInfo-L
As we have discussed before, the Centroid of a geometry was not
designed to be mathematically pure. The goals which were set many
years ago, were to provide a point which was guaranteed to be inside
the geometry( for a region) and on the line (for a line/polyline).
This "centroid" is used by the marquee (rectangle) select tools as
well as the circle select tool and by the "within" and "contains"
operators in SQL/MapBasic. For regions, the centroid is used for
labelling.

For whatever reasons, there was call to allow the region centroid to
be user altered (probably for purposes of finding a more perfect label
position). There was never such a request for polylines and so the
centroid of the polyline cannot be altered. Given that it must be "on
the line" it would probably be tricky to perfectly generate that
point.

The centroid is recalculated every time the geometry is altered and
can be retrieved by the function Centroid (obj_variable) as a point
geometry. The values can be queried by the functions CentroidX() and
CentroidY().

The rules for calculating the centroid of a polyline (and line works
too) are this:
1) If the geometry has a odd number of segments, the centroid is
placed in the middle of the middle segment.
2) if the geometry has an even number of segements, the centroid is at
the middle node (even number of segments means an odd number of
points).

If the polyline is a multi-polyline this calculation is done on the
longest polyline (section) of the multi-polyline.

Note that the directional arrow display is different for case #2. The
arrow as well as the label position are always in the middle of a
segment as Uffe noted. However, the centroid() returned would not be
at that point but at the next node.

The label point being in the middle of a segment makes perfect sense.
As to why the centroid in case #2 is at a point, I do not know other
than this probably seemed more precise even though in neither case is
the location related to distance. So if you had a polyline with a few
long segments followed by many short segments, the centroid would
still be towards the end of the geometry. The calculation is by node
index position, not length.

I hope this helps.
Eric Blasenheim
PBBI (MapInfo)




On Oct 29, 2:52 am, Uffe Kousgaard <u...@routeware.dk> wrote:
> Hi Peter,
> There seems to be 2 kind of centroids:
> 1) When there is an even number of nodes ( = uneven number of arcs)
> This will put the arrow halfway on the mid-arc
> 2) When there is an uneven number of nodes ( = even number of arcs)
> This will put the arrow halfway on the arc before the mid-node
> If you update the table with obj = centroid(obj), the new point is now the same in situation 1), but for 2) the point is on the mid-node, i.e. different.
> A more "true" centroid would be halfway down the whole polyline. MapInfo do not support that.
> Regards
> Uffe Kousgaard
> Peter Horsbøll Møller wrote:Nick,Turn on the line direction and you will see an arrow where the centroid is
>
>
> Peter Horsbøll Møller
> Pitney Bowes Business Insight - MapInfo2010/10/29<nicholas....@tmr.qld.gov.au>
> email tomap...@googlegroups.com
> To unsubscribe from this group, go to:http://groups.google.com/group/mapinfo-l/subscribe?hl=en
> For more options, information and links to MapInfo resources (searching
> archives, feature requests, to visit our Wiki, visit the Welcome page athttp://groups.google.com/group/mapinfo-l?hl=en
>
> --
> You received this message because you are subscribed to the
> Google Groups "MapInfo-L" group.To post a message to this group, send
> email tomap...@googlegroups.com

Natalie Bennett

unread,
Nov 28, 2010, 8:08:02 PM11/28/10
to MapInfo-L
Hi all,

This may sound like a strange topic, but is has been confounding me
(and my patient contact at MapInfo) for a while.

Basically, my contact asked why I would want to see the Line Direction
at all, so I replied:

"It might be worth searching the user forums online for "line
direction" to see just how many users are using this functionality.
Similarly, the inclusion of the tool on the MapCad toolbar shows that
the direction is relevant. For me, there are a number of different
applications, including:

* Direction of arrows when using an arrowed line style, for such things
as
- Sewer Rising Mains - this indicates the direction of flow of the
pumped sewage
- Gravity Mains - this indicates the direction of the flow based on the
contours, and will be used for water & sewer

* Direction of nodes when writing MapBasic scripts which calculate the
placement of nodes along a length, for such things as road chainage - I
may want to insert a node to enable a segmentation of roads between
points - for example, road assets are maintained as segments, and the
history of that segment is attached to the segment - each segment is
described based on "chainage" - the point along the whole length where
it starts and finishes"


So relevantly, the most recent reply from PBBI was (I have been away):

"Further to our previous correspondence on this topic, we've been
researching the logic and behaviour of the line direction markers in
MapInfo Professional. We can provide the following clarifications to
help understand how this part of the application is designed to
function:

* The Line Direction Arrow is draw at the same location as the
label (if label partial objects is not enabled), that is, the middle of
the line.

* Line width affects the size of the arrow, thicker lines will
have thicker arrows

* The Line Direction Arrow needs to be able to fit between two
nodes on a line

Therefore some implications of this (for your Use Case scenarios) are:

* If the middle of the line is not visible the Line Direction
Arrow will not be visible

* If the space between two nodes is not big enough to render
the arrow it will not be drawn, for high resolution lines (e.g. the
lines in your sample file have nodes close together and would be
considered high resolution) viewed at large zoom there is only small
distances between nodes (not enough to render the line direction arrow)

We hope this provides a more complete explanation of the behaviour you
have been seeing. If you would like to discuss further please let us
know, I'm out of the office Monday & Tuesday next week but available
from Wednesday on if you'd like to talk on the phone."


I would still like this to work, but from earlier comments, it seems
that this is more complex than it seems. I particularly like the
suggestion of a Thematic Point layer to create a Point at the Centroid
of each polyline - totally innovative thinking!!

Regards


Nat Bennett
GIS Officer
Wellington Council
(02) 6840 1728

>>> Eric Blasenheim <eric.bl...@pb.com> 30/10/2010 9:14 am >>>

email to mapi...@googlegroups.com

To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources
(searching
archives, feature requests, to visit our Wiki, visit the Welcome page
at
http://groups.google.com/group/mapinfo-l?hl=en

_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning Services - powered by MessageLabs. For further information
visit http://www.mci.com

Reply all
Reply to author
Forward
0 new messages