Antoine Facchini 97b288dcee
Add roundness method to curve polygon (#45154)
* add roundness function

* add roundness function tests

* add roundness function help

* add roundness expression

* add roundness expression tests

* add roundness expression help

* add roundness processing

* add roundness processing tests

* add roundness processing help

* fix import and typo

* Fix typo

Co-authored-by: Harrissou Sant-anna <delazj@gmail.com>

* Add tag

Co-authored-by: Harrissou Sant-anna <delazj@gmail.com>

* Fix typo

Co-authored-by: Harrissou Sant-anna <delazj@gmail.com>

* Modify the description

Co-authored-by: Harrissou Sant-anna <delazj@gmail.com>

* Replace equality condition by qgsDoubleNear

Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>

* Change types for literals

Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>

* add since version

Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>

* add a const

* add the \since adding in the sip file

* Fix typo

Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>

* Fix typo

Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>

* Remove SIP factory annotation

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Remove double calculation of permimeter

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Always add an attribute

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Use QGSCOMPARENEAR in tests

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Shorten the short description

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Make a more complete help string

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* Correct the description

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>

* reformat bad code styles

* sipify

Co-authored-by: Harrissou Sant-anna <delazj@gmail.com>
Co-authored-by: Loïc Bartoletti <lbartoletti@users.noreply.github.com>
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
2021-11-04 08:44:03 +01:00

13 lines
576 B
Plaintext

{
"name": "roundness",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Calculates how close a polygon shape is to a circle. The function returns 1 when the polygon shape is a perfect circle and 0 when it is completely flat.",
"arguments": [
{"arg":"geometry","description":"a polygon"}],
"examples": [
{ "expression":"round(roundness(geom_from_wkt('POLYGON(( 0 0, 0 1, 1 1, 1 0, 0 0))')), 3)", "returns":"0.785"},
{ "expression":"round(roundness(geom_from_wkt('POLYGON(( 0 0, 0 0.1, 1 0.1, 1 0, 0 0))')), 3)", "returns":"0.260"}
]
}