title: How do I get the area of a GeoJSON polygon with Python
body: <p>I have the GeoJSON</p>
  
  <pre><code>{
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {},
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [[13.65374516425911, 52.38533382814119], [13.65239769133293, 52.38675829106993], [13.64970274383571, 52.38675829106993], [13.64835527090953, 52.38533382814119], [13.64970274383571, 52.38390931824483], [13.65239769133293, 52.38390931824483], [13.65374516425911, 52.38533382814119]]
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>which <a href="http://geojson.io" rel="noreferrer">http://geojson.io</a> displays as</p>
  
  <p><a href="https://i.stack.imgur.com/m3xjf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/m3xjf.png" alt="enter image description here"></a></p>
  
  <p>I would like to calculate its area (87106.33m^2) with Python. How do I do that?</p>
  
  <h2>What I tried</h2>
  
  <pre><code># core modules
  from functools import partial
  
  # 3rd pary modules
  from shapely.geometry import Polygon
  from shapely.ops import transform
  import pyproj
  
  l = [[13.65374516425911, 52.38533382814119, 0.0], [13.65239769133293, 52.38675829106993, 0.0], [13.64970274383571, 52.38675829106993, 0.0], [13.64835527090953, 52.38533382814119, 0.0], [13.64970274383571, 52.38390931824483, 0.0], [13.65239769133293, 52.38390931824483, 0.0], [13.65374516425911, 52.38533382814119, 0.0]]
  polygon = Polygon(l)
  
  print(polygon.area)
  proj = partial(pyproj.transform, pyproj.Proj(init='epsg:4326'),
                     pyproj.Proj(init='epsg:3857'))
  print(transform(proj, polygon).area)
  </code></pre>
  
  <p>It gives <code>1.1516745933889345e-05</code> and <code>233827.03300877335</code> - that the first one doesn't make any sense was expected, but how do I fix the second one? (I have no idea how to set the <code>pyproj.Proj</code> init parameter)</p>
  
  <p>I guess <code>epsg:4326</code> makes sense at it is WGS84 (<a href="http://spatialreference.org/ref/epsg/wgs-84/" rel="noreferrer">source</a>), but for <a href="http://spatialreference.org/ref/sr-org/6864/" rel="noreferrer">epsg:3857</a> I'm uncertain.</p>
  
  <h2>Better results</h2>
  
  <p>The following is a lot closer:</p>
  
  <pre><code># core modules
  from functools import partial
  
  # 3rd pary modules
  import pyproj
  from shapely.geometry import Polygon
  import shapely.ops as ops
  
  l = [[13.65374516425911, 52.38533382814119, 0],
       [13.65239769133293, 52.38675829106993, 0],
       [13.64970274383571, 52.38675829106993, 0],
       [13.64835527090953, 52.38533382814119, 0],
       [13.64970274383571, 52.38390931824483, 0],
       [13.65239769133293, 52.38390931824483, 0],
       [13.65374516425911, 52.38533382814119, 0]]
  polygon = Polygon(l)
  
  print(polygon.area)
  geom_area = ops.transform(
      partial(
          pyproj.transform,
          pyproj.Proj(init='EPSG:4326'),
          pyproj.Proj(
              proj='aea',
              lat1=polygon.bounds[1],
              lat2=polygon.bounds[3])),
      polygon)
  print(geom_area.area)
  </code></pre>
  
  <p>it gives 87254.7m^2 - that is still 148m^2 different from what geojson.io says. Why is that the case?</p>