title: numpy meshgrid to Shapely polygons
body: <p>I'm trying to create a numpy meshgrid and convert it to Shapely polygons. I can likely solve this with a very brute force method but it feels like there has to be a good trick to accomplish this but I haven't come up with it, yet. </p>
  
  <p>This gets me the grid of points (assumed running in Jupyter) -</p>
  
  <pre><code>import numpy as np
  from matplotlib import pyplot
  
  fig = pyplot.figure(figsize=(10, 10))
  ax = fig.add_subplot(111, aspect='equal')
  
  x,y = np.mgrid[-5:-1:8j, 1:5:8j]
  ax.plot(x,y, 'o', color='#000000')
  pyplot.show()
  </code></pre>
  
  <p>Now the need is to connect all of these points horizontally and vertically to form Shapely polygons. My first attempt at this was to generate a Shapely MultiLineString to draw vertical and horizontal lines and then perform a polygonize operation on it. This resulted in only the main outer polygon being created - this is due to the MultiLineString only containing vertices on the outer polygon.</p>
  
  <p>I know this might be more reasonable using rasters and GDAL but my circumstances require the end result to be Shapely polygons.</p>
  
  <p>Any help tracking down a solution is appreciated!</p>