class_docstr: Web Feature Service (WFS) retrieval for Cartopy.
class_docstr_tok: ["Web","Feature","Service","(","WFS",")","retrieval","for","Cartopy","."]
docstr: Return any Point, Linestring or LinearRing geometries available
  from the WFS that lie within the specified extent.
  
  Parameters
  ----------
  projection: :class:`cartopy.crs.Projection`
      The projection in which the extent is specified and in
      which the geometries should be returned. Only the default
      (native) projection is supported.
  extent: four element tuple
      (min_x, max_x, min_y, max_y) tuple defining the geographic extent
      of the geometries to obtain.
  
  Returns
  -------
  geoms
      A list of Shapely geometries.
docstr_tok: ["Return","any","Point",",","Linestring","or","LinearRing","geometries","available","from","the","WFS","that","lie","within","the","specified","extent",".","Parameters","--","--","--","--","--","projection",":",":","class",":","`","cartopy.crs.Projection","`","The","projection","in","which","the","extent","is","specified","and","in","which","the","geometries","should","be","returned",".","Only","the","default","(","native",")","projection","is","supported",".","extent",":","four","element","tuple","(","min_x",",","max_x",",","min_y",",","max_y",")","tuple","defining","the","geographic","extent","of","the","geometries","to","obtain",".","Returns","--","--","--","-","geoms","A","list","of","Shapely","geometries","."]
code: def fetch_geometries(self, projection, extent):
      """
      Return any Point, Linestring or LinearRing geometries available
      from the WFS that lie within the specified extent.
  
      Parameters
      ----------
      projection: :class:`cartopy.crs.Projection`
          The projection in which the extent is specified and in
          which the geometries should be returned. Only the default
          (native) projection is supported.
      extent: four element tuple
          (min_x, max_x, min_y, max_y) tuple defining the geographic extent
          of the geometries to obtain.
  
      Returns
      -------
      geoms
          A list of Shapely geometries.
  
      """
      if self.default_projection() != projection:
          raise ValueError(
              "Geometries are only available in projection "
              f"{self.default_projection()!r}."
          )
  
      min_x, max_x, min_y, max_y = extent
      response = self.service.getfeature(
          typename=self.features,
          bbox=(min_x, min_y, max_x, max_y),
          **self.getfeature_extra_kwargs,
      )
      geoms_by_srs = self._to_shapely_geoms(response)
      if not geoms_by_srs:
          geoms = []
      elif len(geoms_by_srs) > 1:
          raise ValueError(
              "Unexpected response from the WFS server. The "
              "geometries are in multiple SRSs, when only one "
              "was expected."
          )
      else:
          srs, geoms = list(geoms_by_srs.items())[0]
          # Attempt to verify the SRS associated with the geometries (if any)
          # matches the specified projection.
          if srs is not None:
              if srs in _URN_TO_CRS:
                  geom_proj = _URN_TO_CRS[srs]
                  if geom_proj != projection:
                      raise ValueError(
                          f"The geometries are not in expected projection. "
                          f"Expected {projection!r}, got {geom_proj!r}."
                      )
              elif ":EPSG:" in srs:
                  epsg_num = srs.split(":")[-1]
                  geom_proj = ccrs.epsg(int(epsg_num))
                  if geom_proj != projection:
                      raise ValueError(
                          f"The EPSG geometries are not in expected "
                          f" projection. Expected {projection!r}, "
                          f" got {geom_proj!r}."
                      )
              else:
                  warnings.warn(
                      f"Unable to verify matching projections due to "
                      f"incomplete mappings from SRS identifiers to cartopy "
                      f"projections. The geometries have an SRS of {srs!r}."
                  )
      return geoms
  
imports: import collections
  import io
  import math
  from urllib.parse import urlparse
  import warnings
  import weakref
  from xml.etree import ElementTree
  import numpy
  from PIL import Image
  import shapely.geometry
  import cartopy.crs
  from cartopy.img_transform import warp_array
  from cartopy.io import LocatedImage, RasterSource
label_desc: Use image node_id 3 for calling the WFSGeometrySource obj's underlying member method code with example usage: obj.fetch_geometries(projection, extent) and returns: geoms