Repository: python-visualization/folium

Issue:
map.get_bounds() fails for map with GeometryCollection
**Describe the bug**
If you add a GeoJson with a GeometryCollection to a Map, Map.get_bounds fails


**To Reproduce**

```
import folium

m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)

geojson_data = {
    "geometries": [
        {
            "coordinates": [
                [
                    [-86.1570813, 39.7567006],
                    [-86.1570169, 39.7566965],
                    [-86.1570169, 39.7566429],
                    [-86.1566146, 39.7566181],
                    [-86.1566092, 39.7566676],
                    [-86.1565288, 39.7566965],
                    [-86.1567645, 39.7572846],
                    [-86.1568399, 39.7572821],
                    [-86.156904, 39.7574413],
                    [-86.1568345, 39.7574718],
                    [-86.1568131, 39.7585688],
                    [-86.1570223, 39.7585729],
                    [-86.1570227, 39.7585614],
                    [-86.1570809, 39.7567123],
                    [-86.1570813, 39.7567006],
                ]
            ],
            "type": "Polygon",
        },
    ],
    "type": "GeometryCollection",
}
folium.GeoJson(geojson_data).add_to(m)

m.get_bounds()
```

**Expected behavior**
I expected this to return a list of two points

**Environment (please complete the following information):**
 - Browser [e.g. chrome, firefox]
 - Jupyter Notebook or html files?
 - Python version (check it with `import sys; print(sys.version_info)`)
 sys.version_info(major=3, minor=9, micro=11, releaselevel='final', serial=0)
 - folium version (check it with `import folium; print(folium.__version__)`)
 0.12.1.post1
 - branca version (check it with `import branca; print(branca.__version__)`)
 0.5.0

**Additional context**
Add any other context about the problem here.

**Possible solutions**
List any solutions you may have come up with.

folium is maintained by volunteers. Can you help making a fix for this issue?


Comments:

Patch:
diff --git a/folium/utilities.py b/folium/utilities.py
index 875ac015..62f5869f 100644
--- a/folium/utilities.py
+++ b/folium/utilities.py
@@ -331,6 +331,8 @@ def iter_coords(obj):
         coords = [geom['geometry']['coordinates'] for geom in obj['features']]
     elif 'geometry' in obj:
         coords = obj['geometry']['coordinates']
+    elif 'geometries' in obj and 'coordinates' in obj['geometries'][0]:
+        coords = obj['geometries'][0]['coordinates']
     else:
         coords = obj.get('coordinates', obj)
     for coord in coords:


Test patch:
diff --git a/tests/test_features.py b/tests/test_features.py
index f2f0611a..b0171640 100644
--- a/tests/test_features.py
+++ b/tests/test_features.py
@@ -314,3 +314,24 @@ def test_geojson_find_identifier():
     geojson.convert_to_feature_collection()
     assert geojson.find_identifier() == 'feature.id'
     assert geojson.data['features'][0]['id'] == '0'
+
+
+def test_geometry_collection_get_bounds():
+    """Assert #1599 is fixed"""
+    geojson_data = {
+        "geometries": [
+            {
+                "coordinates": [
+                    [
+                        [-1, 1],
+                        [0, 2],
+                        [-3, 4],
+                        [2, 0],
+                    ]
+                ],
+                "type": "Polygon",
+            },
+        ],
+        "type": "GeometryCollection",
+    }
+    assert folium.GeoJson(geojson_data).get_bounds() == [[0, -3], [4, 2]]