cartagen.simplify_raposo

cartagen.simplify_raposo#

simplify_raposo(geometry, initial_scale, final_scale, centroid=True, tobler=False)#

Simplify a line or a polygon using an hexagonal tessellation.

This algorithm proposed by Raposo [1] simplifies lines based on a hexagonal tessellation. The algorithm also works for the simplification of the border of a polygon object. The idea of the algorithm is to put a hexagonal tessellation on top of the line to simplify, the size of the cells depending on the targeted granularity of the line. Similarly to the Li-Openshaw algorithm, only one vertex is kept inside each cell. This point can be the centroid of the removed vertices, or a projection on the initial line of this centroid. The shapes obtained with this algorithm are less sharp than the ones obtained with other algorithms such as Douglas-Peucker.

The algorithm is dedicated to the smooth simplification of natural features such as rivers, forests, coastlines, lakes.

Parameters:
  • geometry (LineString, MultiLineString, Polygon, MultiPolygon, LinearRing) – The line to simplify.

  • initial_scale (float) – Initial scale of the provided line (25000.0 for 1:25000 scale).

  • final_scale (float) – Final scale of the simplified line.

  • centroid (bool, optional) – If true, uses the center of the hexagonal cells as the new vertex, if false, the center is projected on the nearest point in the initial line.

  • tobler (bool, optional) – If True, compute cell resolution based on Tobler’s formula, else uses Raposo’s formula

Returns:

LineString, MultiLineString, Polygon, MultiPolygon, LinearRing

See also

simplify_angular

Simplify a line or polygon by removing vertexes with small angles.

simplify_douglas_peucker

Simplify a line or polygon using a distance-based selection.

simplify_lang

Simplify a line or polygon using a look-ahead distance-based selection.

simplify_li_openshaw

Simplify a line or a polygon using a regular grid.

simplify_reumann_witkam

Simplify a line or polygon using a directional distance-based selection.

simplify_visvalingam_whyatt

Simplify a line or polygon using an area-based selection.

simplify_wang_muller

Simplify a line or polygon using a bend-reduction method.

simplify_whirlpool

Simplify a line or polygon using an epsilon-circle based selection.

Notes

The Tobler based formula to compute hexagonal cell size is \(cellsize=5·l·s\) where \(l\) is the width of the line in the map in meters (e.g. 0.0005 for 0.5 mm), and \(s\) is the target scale denominator.

Raposo’s formula to compute hexagonal cell size is \(cellsize={l/n}·{t/d}\) where \(l\) is the length of the line, \(n\) the number of vertices of the line, \(t\) the denominator of the target scale, and \(d\) the denominator of the initial scale.

References

Examples

>>> line = LineString([(0, 0), (1, 1), (2, 0), (5, 3)])
>>> c4.simplify_raposo(line, 5000, 10000)
<LINESTRING (0 0, 1 0.3333333333333333, 5 3)>

(Source code)

../_images/simplify_raposo.png