class_docstr: Web Feature Service (WFS) retrieval for Cartopy.
class_docstr_tok: ["Web","Feature","Service","(","WFS",")","retrieval","for","Cartopy","."]
docstr: Convert polygon coordinate strings in WFS response XML to Shapely
  geometries.
  
  Parameters
  ----------
  response: (file-like object)
      WFS response XML data.
  
  Returns
  -------
  geoms_by_srs
      A dictionary containing geometries, with key-value pairs of
      the form {srsname: [geoms]}.
docstr_tok: ["Convert","polygon","coordinate","strings","in","WFS","response","XML","to","Shapely","geometries",".","Parameters","--","--","--","--","--","response",":","(","file-like","object",")","WFS","response","XML","data",".","Returns","--","--","--","-","geoms_by_srs","A","dictionary","containing","geometries",",","with","key-value","pairs","of","the","form","{","srsname",":","[","geoms","]","}","."]
code: def _to_shapely_geoms(self, response):
      """
      Convert polygon coordinate strings in WFS response XML to Shapely
      geometries.
  
      Parameters
      ----------
      response: (file-like object)
          WFS response XML data.
  
      Returns
      -------
      geoms_by_srs
          A dictionary containing geometries, with key-value pairs of
          the form {srsname: [geoms]}.
  
      """
      linear_rings_data = []
      linestrings_data = []
      points_data = []
      tree = ElementTree.parse(response)
  
      # Get geometries from http://mapserver.gis.umn.edu/mapserver
      # and other servers
      for node in tree.iter():
          snode = str(node)
          if (_MAP_SERVER_NS in snode) or (
              self.url and (self.url in snode)
          ):
              s1 = snode.split()[1]
              tag = s1[s1.find("}") + 1 : -1]
              if ("geom" in tag) or ("Geom" in tag):
                  # Find LinearRing geometries in our msGeometry node.
                  find_str = f".//{_GML_NS}LinearRing"
                  if self._node_has_child(node, find_str):
                      data = self._find_polygon_coords(node, find_str)
                      linear_rings_data.extend(data)
  
                  # Find LineString geometries in our msGeometry node.
                  find_str = f".//{_GML_NS}LineString"
                  if self._node_has_child(node, find_str):
                      data = self._find_polygon_coords(node, find_str)
                      linestrings_data.extend(data)
  
                  # Find Point geometries in our msGeometry node.
                  find_str = f".//{_GML_NS}Point"
                  if self._node_has_child(node, find_str):
                      data = self._find_polygon_coords(node, find_str)
                      points_data.extend(data)
  
      geoms_by_srs = {}
      for srs, x, y in linear_rings_data:
          geoms_by_srs.setdefault(srs, []).append(
              sgeom.LinearRing(zip(x, y))
          )
      for srs, x, y in linestrings_data:
          geoms_by_srs.setdefault(srs, []).append(
              sgeom.LineString(zip(x, y))
          )
      for srs, x, y in points_data:
          geoms_by_srs.setdefault(srs, []).append(
              sgeom.Point(zip(x, y))
          )
      return geoms_by_srs
  
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 4 for calling the WFSGeometrySource obj's underlying member method code with example usage: obj._to_shapely_geoms(response) and returns: geoms_by_srs