Moving a centroid-new problems

131 views
Skip to first unread message

Hankins, Michael D.

unread,
Nov 28, 2011, 1:45:28 PM11/28/11
to mapi...@googlegroups.com
Good afternoon,

I posted a request in august 2010 about moving the centroid. I got the answer and that solved my problem. Now, I have used gridmaker to slice up some files. My grids are 1/100 degree grids of certain states. So this has created hundreds of little triangles (not all right triangles do this, but all of the objects that are wrong are right triangles)whose centroids are outside of the object (barely out). So when I update column, I am getting incorrect results. I have tried restore centroid (J Paris MBX), but it does not seem to work on such small objects. I also converted the objects to polylines and back to regions and that failed to move the centroid inside the triangle objects. I tried to look up calculations for center of mass of an object instead of centroid or to replace the centroid returned by MapInfo, but I am apparently not smart enough to follow and code the formula. I also tried to edit the center point of the object, but that moved the entire object, not the centroid dot.

Since the right triangle object issue has been known for some time (Schmiez talked about the right triangle pitfalls in 2010), my question is this: Is there a formula I can use to calculate the center of mass of certain objects better than MapInfo does and actually change the location of the stored centroid?

If I don't like where MapInfo Pro places the centroid, why can't I easily change it? Is there a simple solution that I am just not seeing?


Mike Hankins
COUNTRY(r) Financial

Tony Pilkington

unread,
Nov 28, 2011, 1:52:22 PM11/28/11
to mapi...@googlegroups.com
A simple solution for triangles is to calculate an internal centroid by
inwardly buffering the triangle a small amount (10 metres say) and use that
centroid. It has to fall within the outer triangle.


Good afternoon,


Mike Hankins
COUNTRY(r) Financial

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


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1873 / Virus Database: 2101/4644 - Release Date: 11/28/11


Hankins, Michael D.

unread,
Nov 28, 2011, 2:04:28 PM11/28/11
to mapi...@googlegroups.com
How do I inwardly buffer? MapInfo Help does not talk about inward buffers.

Tony Pilkington

unread,
Nov 28, 2011, 2:09:04 PM11/28/11
to mapi...@googlegroups.com
Set a negative value for the buffer size; ie new_blob=buffer(old_blob,
12, -10, "m") will produce a smaller slightly rounded version of the
original object.

David Reid

unread,
Nov 28, 2011, 2:11:14 PM11/28/11
to mapi...@googlegroups.com

Simply enter a negative number for your buffer size...

Buffer: -100 would give you an "inward" buffer of 100 units"

Hankins, Michael D.

unread,
Nov 28, 2011, 2:15:10 PM11/28/11
to mapi...@googlegroups.com
The Concentric Ring buffer MBX will not allow a negative radius. I tried. A negative radius will work in mapbasic, but not with a MapInfo created tool?

Tony Pilkington

unread,
Nov 28, 2011, 2:31:26 PM11/28/11
to mapi...@googlegroups.com
Assuming you are working on a copy of the data, try:
Map-options-show mapbasic window
type in
set coordsys window frontwindow()
update the_table set obj=buffer(obj,12 -10,"m")

You can then extract the new centroid.

David Reid

unread,
Nov 28, 2011, 2:34:00 PM11/28/11
to mapi...@googlegroups.com

Using the CRB tool here is a little "over powered" or "mis-tasked", as you
only need the one "buffer object", use the standard buffer tool.

From the file menu: [Object] "Buffer"
Or
Right click context menu: [Edit Objects]: "Buffer"

This would be a nice time to be able to buffer by percentage instead of
static values, but maybe newer versions of MI allow this.

Hankins, Michael D.

unread,
Nov 28, 2011, 2:48:02 PM11/28/11
to mapi...@googlegroups.com
I am much more comfortable in MI Pro, so I used the buffer tool (feel like a moron, only had used CRB before, not the easy buffer) to create inner buffers. That worked great. I just don't get how I can use the new object centroid to change the old object centroid.

Thank you for helping me on this

Mike

Hankins, Michael D.

unread,
Nov 28, 2011, 2:57:04 PM11/28/11
to mapi...@googlegroups.com
Dear MapInfo Professional designers (Santa),

Why put the centroid on the hypotenuse of the right triangle if the centroid is supposed to be INSIDE the object? Please put it INSIDE the object. End users update using objects ALL the time, which can return incorrect answers IF the centroid falls on the edge of the object. Please consider trying to fix this little issue for me.

Michael Hankins--MI Pro user since 1998

Gamiz Ribelles, Sergi (Regsa)

unread,
Nov 29, 2011, 4:21:32 AM11/29/11
to mapi...@googlegroups.com

Mike, good morning
I've built a little code, it's only a testing part for another tool (oriented to shape recognition). The code I attach can recognize multipolygon regions: relation among polygons, area, perimeters and centroids calculated with nodes of polygons, and totals for region. In the secction '-----calcs Area & perimeters, cartesian method by nodes---- you can learn the calculus to get centroids as mass-center. At the end this code prints, and you can compare, calculated centroid and MapInfo centroid, which is restricted to be within region.

Please, ignore the secction '---------Radii index (Boyle & ClarK) ------------, because is still under development and it's not relevant at all for you. When I finish my investigation about the right radii index I'll post here.

Hope this helps

Sergi Gamiz Ribelles


-----Mensaje original-----
De: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] En nombre de Hankins, Michael D.
Enviado el: dilluns, 28 / novembre / 2011 19:45
Para: 'mapi...@googlegroups.com'
Asunto: [MI-L] Moving a centroid-new problems

APCGM_20.MB
Reply all
Reply to author
Forward
0 new messages