How to create a Feature Collection from a GeoJSON
<p>I have a <code>Feature Collection</code> of <code>Polygons</code> and <code>MultiPolygons</code> and I have to first write it in a temporary file to then load it with geopandas.GeoDataFrame.from_file(tmp_json_file), I'm looking for a way to do it without the temporary file. I've tried to use <code>geopandas.GeoDataFrame.from_feature()</code>, it works pretty well for Feature Collection of simple Polygon but i can't make it work for <code>Feature Collection</code> of <code>Polygons</code> and <code>MultiPolygons</code>, I was thinking about doing something like below, but it's not working yet. </p>

<pre><code>features_collection = []

for feature in json_data['features']:
   tmp_properties = {'id': feature['properties']['id']}

   if is_multipolygon (feature):
       tmp = Feature(geometry=MultiPolygon((feature['geometry']['coordinates'])), properties=tmp_properties)
   else: 
       Feature(geometry=Polygon((feature['geometry']['coordinates'])), properties=tmp_properties)
   features_collection.append(tmp)

collection = FeatureCollection(features_collection)

return geopandas.GeoDataFrame.from_features(collection['features'])
</code></pre>

<p>The GeoJSON is taken from an API, returning territory (some territory are modelized by a single polygon, other by a set of polygons (formatted as a MultiPolygon). </p>

<p>The GeoJSON are structured as follow : <a href="http://pastebin.com/PPdMUGkY" rel="nofollow">http://pastebin.com/PPdMUGkY</a> </p>

<p>I'm getting the following error from the function above : </p>

<pre><code>Traceback (most recent call last):
  File "overlap.py", line 210, in &lt;module&gt;
    print bdv_json_to_geodf(contours_bdv)
  File "overlap.py", line 148, in json_to_geodf
    return geopandas.GeoDataFrame.from_features(collection['features'])
  File "/Library/Python/2.7/site-packages/geopandas/geodataframe.py", line 179, in from_features
    d = {'geometry': shape(f['geometry'])}
  File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/geometry/geo.py", line 40, in shape
    return MultiPolygon(ob["coordinates"], context_type='geojson')
  File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/geometry/multipolygon.py", line 64, in __init__
    self._geom, self._ndim = geos_multipolygon_from_py(polygons)
  File "/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7/site-packages/shapely/geometry/multipolygon.py", line 138, in geos_multipolygon_from_py
    N = len(ob[0][0][0])
TypeError: object of type 'float' has no len()
</code></pre>