pyinterp.core.geodetic.Polygon

class pyinterp.core.geodetic.Polygon(self, outer: list[pyinterp.core.geodetic.Point], inners: list[list[pyinterp.core.geodetic.Point]] | None = None)

Bases: pybind11_object

Create a polygon with an outer ring and optional inner rings.

The polygon contains an outer ring and zero or more inner rings.

Parameters:
  • outer – Outer ring.

  • inners – List of inner rings.

Raises:
  • ValueError – If outer is not a list of pyinterp.geodetic.Point.

  • ValueError – If inners is not a list of list of pyinterp.geodetic.Point.

Attributes

inners

The inner rings.

is_valid

Return whether the polygon is valid.

outer

The outer ring.

Public Methods

area(self[, wgs])

Calculates the area.

correct(self)

Correct a polygon.

covered_by(*args, **kwargs)

Overloaded function.

difference(self, other)

Computes the difference of this polygon with another.

distance(*args, **kwargs)

Overloaded function.

envelope(self)

Calculates the envelope of this polygon.

from_geojson(array)

Creates a polygon from a GeoJSON coordinates array.

intersection(*args, **kwargs)

Overloaded function.

intersects(self, other)

Check if this polygon intersects another.

num_interior_rings(self)

Return the number of interior rings.

perimeter(self[, wgs])

Compute the perimeter of this polygon.

read_wkt(wkt)

Parses OGC Well-Known Text (WKT) into a polygon.

simplify(self, tolerance)

Simplifies a polygon.

to_geojson(self)

Return the polygon as a GeoJSON type.

touches(self, other)

Check if this polygon touches another.

union(self, other)

Compute the union of this polygon with another.

wkt(self)

Get the OGC Well-Known Text (WKT) representation of this instance.

Special Methods

__copy__(self)

Implement the shallow copy operation.

__eq__(self, other)

Override the default behavior of the == operator.

__getstate__(self, /)

__ne__(self, other)

Override the default behavior of the != operator.

__repr__(self)

Return the string representation of this polygon.

__setstate__(self, arg0)