Python 我想将传单中的所有要素集合转换为几何体集合

Python 我想将传单中的所有要素集合转换为几何体集合,python,json,leaflet,gis,geojson,Python,Json,Leaflet,Gis,Geojson,例如,toGeoJSON函数返回如下内容: var geojsonFeature = { "type": "Feature", "properties": { "name": "Coors Field", "amenity": "Baseball Stadium", "popupContent": "This is where the Rockies play!" }, "geometry": { "

例如,toGeoJSON函数返回如下内容:

var geojsonFeature = {
    "type": "Feature",
    "properties": {
        "name": "Coors Field",
        "amenity": "Baseball Stadium",
        "popupContent": "This is where the Rockies play!"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [-104.99404, 39.75621]
    }
};
但我想专门使用GeometryCollection,而不是这里描述的FeatureCollection。我有办法做到吗


有关更多信息,我希望复制中复选标记的答案中描述的行为,但我希望改用GeometryCollections。非常感谢。

我找到了解决办法。为了将其持久化为GeometryCollection,我使用了djang_rest_gis框架中描述的序列化程序。因此,我能够将多边形转化为GeosGeometry对象,并将其序列化