spherely.from_geoarrow

Contents

spherely.from_geoarrow#

spherely.from_geoarrow(input: object, /, *, oriented: bool = False, planar: bool = False, tessellate_tolerance: float = 100.0, projection: spherely.Projection = <spherely.Projection object at 0x7faf6fcc4830>, geometry_encoding: object = None) Geography | array_like#

Create an array of geographies from an Arrow array object with a GeoArrow extension type.

See https://geoarrow.org/ for details on the GeoArrow specification.

This functions accepts any Arrow array object implementing the Arrow PyCapsule Protocol (i.e. having an __arrow_c_array__ method).

Parameters:
  • input (pyarrow.Array, Arrow array) – Any array object implementing the Arrow PyCapsule Protocol (i.e. has a __arrow_c_array__ method). The type of the array should be one of the geoarrow geometry types.

  • oriented (bool, default False) – Set to True if polygon ring directions are known to be correct (i.e., exterior rings are defined counter clockwise and interior rings are defined clockwise). By default (False), it will return the polygon with the smaller area.

  • planar (bool, default False) – If set to True, the edges of linestrings and polygons are assumed to be linear on the plane. In that case, additional points will be added to the line while creating the geography objects, to ensure every point is within the tessellate_tolerance distance (100m by default) of the original line. By default (False), it is assumed that the edges are spherical (i.e. represent the shortest path on the sphere between two points).

  • tessellate_tolerance (float, default 100.0) – The maximum distance in meters that a point must be moved to satisfy the planar edge constraint. This is only used if planar is set to True.

  • projection (spherely.Projection, default Projection.lnglat()) – The projection of the input coordinates. By default, it assumes longitude/latitude coordinates, but this option allows to convert from coordinates in pseudo-mercator or orthographic projection as well.

  • geometry_encoding (str, default None) – By default, the encoding is inferred from the GeoArrow extension type of the input array. However, for parsing WKT and WKB it is also possible to pass an Arrow array without geoarrow type but with a plain string or binary type, if specifying this keyword with “WKT” or “WKB”, respectively.