Skip to Content

dessine aire

  1. from descartes.patch import PolygonPatch
  2.  
  3. def plot_poly(ax,ob):
  4. patch = PolygonPatch(ob, facecolor='#6699cc', edgecolor='#6699cc')
  5. ax.add_patch(patch)
  6.  
  7. def plot_multipol(ax,ob):
  8. for polygon in ob:
  9. plot_poly(ax,polygon)
  10. poly = loads('POLYGON ((1 2, 2 5, 6 5, 7 2, 5 1, 1 2))')
  11. multipoly = loads('MULTIPOLYGON (((2 4, 1 3, 2 2, 4 3, 2 4)),((5 2, 4 2, 4 1, 4 1, 5 1, 5 2)))')
  12.  
  13. plot_poly(ax,poly)
  14. plot_multipol(ax, multipoly)