gws.gis.extent

Source code: gws.gis.extent

Package Contents

gws.gis.extent.from_string(s: str) gws.Extent | None

Create an extent from a comma-separated string “1000,2000,20000 40000”.

Parameters:

s"x-min,y-min,x-max,y-max"

Returns:

An extent.

gws.gis.extent.from_list(ls: list) gws.Extent | None

Create an extent from a list of values.

Parameters:

ls[x-min,y-min,x-max,y-max]

Returns:

An extent.

gws.gis.extent.from_points(a: gws.Point, b: gws.Point) gws.Extent

Create an extent from two points.

Parameters:
  • a(x-min,y-min)

  • b(x-max,y-max)

Returns:

An extent.

gws.gis.extent.from_center(xy: gws.Point, size: gws.Size) gws.Extent

Create an extent with certain size from a center-point.

Parameters:
  • xy – Center-point (x,y)

  • size – Extent’s size.

Returns:

An Extent.

gws.gis.extent.from_box(box: str) gws.Extent | None

Create an extent from a Postgis BOX(1000 2000,20000 40000).

Parameters:

box – Postgis BOX.

Returns:

An extent.

gws.gis.extent.intersection(exts: list[gws.Extent]) gws.Extent | None

Creates an extent that is the intersection of all given extents.

Parameters:

exts – Extents.

Returns:

An extent.

gws.gis.extent.center(e: gws.Extent) gws.Point

The center-point of the extent

gws.gis.extent.size(e: gws.Extent) gws.Size

The size of the extent ``(width,height)

gws.gis.extent.diagonal(e: gws.Extent) float

The length of the diagonal

gws.gis.extent.circumsquare(e: gws.Extent) gws.Extent

A circumscribed square of the extent.

gws.gis.extent.buffer(e: gws.Extent, buf: int) gws.Extent

Creates an extent with buffer to another extent.

Parameters:
  • e – An extent.

  • buf – Buffer between e and the output. If buf is positive the returned extent will be bigger.

Returns:

An extent.

gws.gis.extent.union(exts: list[gws.Extent]) gws.Extent

Creates the smallest extent that contains all the given extents.

Parameters:

exts – Extents.

Returns:

An Extent.

gws.gis.extent.intersect(a: gws.Extent, b: gws.Extent) bool

Returns True if the extents are intersecting, otherwise False.

gws.gis.extent.transform(e: gws.Extent, crs_from: gws.Crs, crs_to: gws.Crs) gws.Extent

Transforms the extent to a different coordinate reference system.

Parameters:
  • e – An extent.

  • crs_from – Input crs.

  • crs_to – Output crs.

Returns:

The transformed extent.

gws.gis.extent.transform_from_wgs(e: gws.Extent, crs_to: gws.Crs) gws.Extent

Transforms the extent in WGS84 to a different coordinate reference system.

Parameters:
  • e – An extent.

  • crs_to – Output crs.

Returns:

The transformed extent.

gws.gis.extent.transform_to_wgs(e: gws.Extent, crs_from: gws.Crs) gws.Extent

Transforms the extent to WGS84.

Parameters:
  • e – An extent.

  • crs_from – Input crs.

Returns:

The WGS84 extent.

gws.gis.extent.swap_xy(e: gws.Extent) gws.Extent

Swaps the x and y values of the extent