I have a table of mapinfo polygons, which includes a number of aggregated polygons. I have used Aggregate Filter and Deaggregate to separate the polygons, however when i use these polygons in spatial queries,i have found that the centroids of the polygons are not toward the centre of the polygons giving me incorrect results. I have checked the centroids in mapinfo and a number of the deaggregated parcel centroids are located in unexpected positions.I am looking for a way to correct the centroid positions, or regenerate new centroids for the polygons.
Page 1 / 1
Hi,
How are you creating the centroids?
The inside point replacer returns a point guaranteed to be inside an area.
Itay
Hi,
I agree that the InsidePointReplacer is a good start, but be aware that even though it is guaranteed to be inside, it is not necessarily in the geometric center of the polyon.
Also look at the CenterPointReplacer and the CenterOfGravityReplacer, but be sure to read the help text before using them to fully understand the differences.
If you want to get fancy, you could do something like starting with the CenterOfGravityReplacer, then using a SpatialFilter to check if the resultant point was outside the polygon (a possibility), and if yes, replacing it with a InsidePointReplacer. This could be turned into a custom transformer for maximum reusability.
David
Hi,
Validating the results is always advisable especially if you have long narrow polygons or u shaped polygons that can return unexpected results.
Hi,
According to my English-Japanese dictionary, the "centroid" is a physics term and it means the center of mass. There are no other explanations. But in fact, some people seem to use this term in other meanings, so I sometimes get confused. My dictionary is wrong?
Anyway, if you need to create the strict "centroid" (center of mass), you should use the CenterOfGravityReplacer, but it may be outside of the original polygon. If you don't want to get outside points, consider using the InsidePointReplacer as Itay suggested, or using the CenterOfGravityReplacer with validation and modification as David mentioned.
The decision depends on your (or your client's) needs.
Takashi
also centrepointreplacer is the center of the features boundingbox
Thank you for all of the suggestions, i will use them to check / update / create the "Centroids" for the Polygons.
.I appreciate that the "centroid" does have a definition of centre of mass for an object and that centre of mass can fall outside the object. The Mapinfo "centroid" for some of the deaggregated polygons falls way outside the object and its bounding box. The only explanation seems to be that its position is an artifact position from the original creation and not an approximation of the "centroid"
Takashi, your dictionary is not wrong, it is a name that Mapinfo gives to a point that usually approximates the centre of mass, but in this case some of them are a long way from the object and its bounding box.