Question

Generalize a polygon by a max number of vertex, max widht and max area forcer

  • 17 January 2018
  • 2 replies
  • 12 views

Badge

I am interested in generalize a polygon following these criteria: max area (areaforcer), max number of vertex and max width allowed (for example a river with maximum width of 3 m and 200 vertex). How could I create this?


2 replies

Badge +10

I find your question a bit hard to solve 1-2-3.

Thinking about a solution for your problem, I was thinking about using a Tiler-transformer to create tiles with a length and width of the max-width allowed. If really necessary, you could also calculate the length and width for a diagonal corresponding to your max width.

You will get a lot of tiles. Those tiles could than be dissolved in larger pieces until you have met your max area. The only thing you need to check than is whether the number of vertices does not exceed your max # of vertices.

Badge +22

My preferred algorithm for generalising to a specific number of vertices is the visvalingham.

 

While not native to FME, there are various website that show the implementation, including some python packages that can be adapted for the PythonCaller.

https://www.jasondavies.com/simplify/

 

https://bost.ocks.org/mike/simplify/

http://mapshaper.org/

https://pypi.python.org/pypi/visvalingam

https://pypi.python.org/pypi/visvalingamwyatt/

 

 

Width, particularly for meandering geometries like rivers, is difficult to determine. For more regular objects, width can be approximated by taking the shorter side of the oriented bounding box. (BoundingBoxReplacer) Otherwise you need to get the medial axis (CenterLineReplacer), and at arbitrary distances along it calculate the local width (various techniques).

Reply