Nik*_*kel 2 python json geojson
我在 Python 的列表中有一个功能列表(所有点)。功能是动态的,源于每隔 30 分钟更新一次的数据库数据。因此,我从来没有静态数量的功能。
我需要生成一个包含列表中所有功能的功能集合。但是(据我所知)创建 FeatureCollection 的语法希望您将所有功能传递给它。
IE:
FeatureClct = FeatureCollection(feature1, feature2, feature3)
Run Code Online (Sandbox Code Playgroud)
在事先不知道有多少特征的情况下,如何生成 FeatureCollection?有没有办法将功能附加到现有的 FeatureCollection 中?
根据 python-geojson 的文档(我猜你正在使用,你没有提到它)你也可以将一个列表传递给FeatureCollection,只需将所有结果放入一个列表中,你就可以开始了:
feature1 = Point((45, 45));
feature2 = Point((-45, -45));
features = [feature1, feature2];
collection = FeatureCollection(features);
Run Code Online (Sandbox Code Playgroud)
https://github.com/frewsxcv/python-geojson#featurecollection
| 归档时间: |
|
| 查看次数: |
2491 次 |
| 最近记录: |