Question

Limit vertices but maintain general polygon shape

  • 8 September 2017
  • 2 replies
  • 32 views

I need to take a polygon feature and create a csv with all the vertices. I have the whole process and it works no problem, except that the amount of vertices has to be limited to 50. I have some very detailed polygons, particularly at coastlines, that become self-intersecting after passing through a vertex limiter.

So far, my process involves a donut hole extractor (process that ingests the csv cannot handle multi-part polygons or holes) and the outershell passes into a vertex limiter (vertex limit:50, aggressiveness level:.001) and then after passing through a geometry validator, the rest of the process creates the csv.

What I need is a small final file, but as much accuracy as possible. I am aware that limiting the vertices from thousands to 50 will create angular polygons, but what I want most is to maintain shared boundaries while still limiting the vertices. I do not want them to overlap, have gaps or self-intersect.

I have tried the generalizer, but I have a specific number of vertices I require no more than for each polygon so I thought the limiter would be a better option.


2 replies

Userlevel 5
Badge +25

The Generalizer in combination with a Chopper could do the trick, but on very detailed coastlines you'll end up with lots of small polygons if you have to stay within that 50-vertex limit.

Badge +22

My preferred algorithm for simplifying data while maintaining shape is Visvalingam. 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/

I have a custom transformer (unfortunately can't share) that uses a hybrid implementation that allows you to choose a reduction percentage, or an absolute number of vertices, but also optionally allows for a Maximum Offset (a la Douglas) to stop the simplification before reaching the specified number of vertices if the next iteration's removal would cause an offset larger than the tolerance.

Reply