Skip to main content
Hello!

 

I have parcels polygons into a databse and I want to determine what kind of geometric shape (square, triangle, rectangle, trapeze, other) each of those polygons have.

 

i am using the circularitycalculator and after a use a testfilter to determine each shape by the shape value (square ~ 0.75, rectangle ~ 0.65, etc).

 

Unfortunately, a lot of polygon have weird values, so my filter doesn't work well.

 

Would you have a better idea?

 

Thanks!!
Hi Philippe,

 

 

Assume that there is no midway point on every edge of the shape.

 

 

Count number of coordinates (CoordinateCounter).

 

In FME, a polygon of N-vertices has N + 1 coordinates, since boundary of a polygon has end point which is on the same location as start point. Therefore:

 

If the number is 4, it's a triangle,

 

if the number is 5, it's a tetragon,

 

and so on.

 

 

Classify a tetragon. Square is a rectangle; rectangle is a parallelogram; parallelogram is a trapezoid; trapezoid is a tetragon.

 

http://en.wikipedia.org/wiki/Quadrilateral

 

If a pair of edges facing each other is parallel, it is a trapezoid, and if another pair is also parallel, it is a  parallelogram.

 

For a parallelogram, calculate the angle which two adjacent edges make. If the result is right angle, it is a rectangle, and if two adjacent edges have the same length, it is a square.

 

 

I think the vector operations would be useful in determination of parallel and right angle. But you always need to be careful about a computational error.

 

Vector and length of edges can be calculated after transforming the tetragon into individual edges with the Chpper (Mode: By Vertex, Maximmum Vertices: 2). Or Python scripting is also possible.

 

 

Alternatively, maybe the BoundingBoxReplacer (Replace With: Oriented Bounding Box) can be also used effectively to classify a tetragon. Comparing original tetragon with oriented bounding box, you can determine whether the tetragon is a rectangle.

 

 

There is always more than one way.

 

 

Takashi
Hi,

 

 

Prior to the topology detect operation i suggest to simplify the objects. As we are talking polyline type objects, it is easy to remove superfluos vertices.

 

 

You also might want to do a edgecounter prior to the search.

 

Would (possibly) greatly reduce search operations.

 

In city of Leiden (where i live) the chances of finding perfect mathematical topology is neigh zero.

 

 

have a nice Fme session.

 

 

Gio

Reply