:tocdepth: 3 :py:mod:`gws.gis.extent` ======================== .. py:module:: gws.gis.extent **Source code:** :source:`gws.gis.extent` Package Contents ---------------- .. py:function:: buffer(e: gws.Extent, buf: int) -> gws.Extent Creates an extent with buffer to another extent. :param e: An extent. :param buf: Buffer between e and the output. If buf is positive the returned extent will be bigger. :returns: An extent. .. py:function:: center(e: gws.Extent) -> gws.Point The center-point of the extent .. py:function:: circumsquare(e: gws.Extent) -> gws.Extent A circumscribed square of the extent. .. py:function:: diagonal(e: gws.Extent) -> float The length of the diagonal .. py:function:: from_box(box: str) -> Optional[gws.Extent] Create an extent from a Postgis BOX(1000 2000,20000 40000). :param box: Postgis BOX. :returns: An extent. .. py:function:: from_center(xy: gws.Point, size: gws.Size) -> gws.Extent Create an extent with certain size from a center-point. :param xy: Center-point ``(x,y)`` :param size: Extent's size. :returns: An Extent. .. py:function:: from_list(ls: list) -> Optional[gws.Extent] Create an extent from a list of values. :param ls: ``[x-min,y-min,x-max,y-max]`` :returns: An extent. .. py:function:: from_points(a: gws.Point, b: gws.Point) -> gws.Extent Create an extent from two points. :param a: ``(x-min,y-min)`` :param b: ``(x-max,y-max)`` :returns: An extent. .. py:function:: from_string(s: str) -> Optional[gws.Extent] Create an extent from a comma-separated string "1000,2000,20000 40000". :param s: ``"x-min,y-min,x-max,y-max"`` :returns: An extent. .. py:function:: intersect(a: gws.Extent, b: gws.Extent) -> bool Returns ``True`` if the extents are intersecting, otherwise ``False``. .. py:function:: intersection(exts: list[gws.Extent]) -> Optional[gws.Extent] Creates an extent that is the intersection of all given extents. :param exts: Extents. :returns: An extent. .. py:function:: is_valid(e: gws.Extent) -> bool .. py:function:: is_valid_wgs(e: gws.Extent) -> bool .. py:function:: size(e: gws.Extent) -> gws.Size The size of the extent ``(width,height) .. py:function:: swap_xy(e: gws.Extent) -> gws.Extent Swaps the x and y values of the extent .. py:function:: transform(e: gws.Extent, crs_from: gws.Crs, crs_to: gws.Crs) -> gws.Extent Transforms the extent to a different coordinate reference system. :param e: An extent. :param crs_from: Input crs. :param crs_to: Output crs. :returns: The transformed extent. .. py:function:: transform_from_wgs(e: gws.Extent, crs_to: gws.Crs) -> gws.Extent Transforms the extent in WGS84 to a different coordinate reference system. :param e: An extent. :param crs_to: Output crs. :returns: The transformed extent. .. py:function:: transform_to_wgs(e: gws.Extent, crs_from: gws.Crs) -> gws.Extent Transforms the extent to WGS84. :param e: An extent. :param crs_from: Input crs. :returns: The WGS84 extent. .. py:function:: union(exts: list[gws.Extent]) -> gws.Extent Creates the smallest extent that contains all the given extents. :param exts: Extents. :returns: An Extent.