title: Python how calculate a polygon perimeter using an osgeo.ogr.Geometry object
body: <p>First of all, I apologize to post this easy question. I need to compute a certain number of gemotrical attributes (area, perimeters, Roundess, major and minor axis, etc). I am using <a href="http://www.osgeo.org/gdal_ogr" rel="nofollow">GDAL/OGR</a> to read a shapefile format of my polygon. What i wish to ask is:</p>
  
  <ol>
  <li>is there a method to compute the perimeter using osgeo.ogr.Geometry?</li>
  <li>is there a module build to compute metrics on polygon?</li>
  </ol>
  
  <p>thanks in advance</p>
  
  <pre><code>    import osgeo.gdal, ogr
      poly="C:\\\myshape.shp"
      shp = osgeo.ogr.Open(poly)
      layer = shp.GetLayer()
      # For every polygon
      for index in xrange(len(allFID)):
          feature = layer.GetFeature(index)
          # get "FID" (Feature ID)
          FID = str(feature.GetFID())
          geometry = feature.GetGeometryRef()
          # get the area
          Area = geometry.GetArea()
  </code></pre>