python - Python 从 Geojson 获取价值
问题描述
请有人可以分享一些python脚本,该脚本将遍历此geojson并检索“附件”下的值。我正在努力解决这些问题。
谢谢
{
"id": 3,
"geom": "POINT (-65621.7187500000000000 6688807.5000000000000000)",
"fields": {
"Identifier": null,
"Species": null,
"Tag_Number": "Quercus robur 505",
},
"extensions": {
"description": null,
"attachment": [
{
"id": 7,
"name": "1531402833735.jpg",
"size": 4559151,
"mime_type": "image/jpeg",
"description": "",
"is_image": true
},
{
"id": 8,
"name": "1531402882838.jpg",
"size": 6418150,
"mime_type": "image/jpeg",
"description": "",
"is_image": true
}
]
}
}
解决方案
Please try this below code
import geojson
gj = geojson.loads(jsonstr)
if "attachment" in gj:
for attachment in gj["attachment"]:
print (attachment)
推荐阅读
- pine-script - Pine 脚本“strategy.position_size”被蜡烛延迟
- c - 如何从C中的scanf输入整数开始打印递减的奇数?
- php - 在 WooCommerce 单品页面隐藏“缺货”相关产品
- python - 如何解决 numpy 数组中值不一致的问题?
- dynamics-crm - 获取销售订单详细信息 Dynamics web Microsoft 365
- flutter - 升级到版本 1.27.0-8.0.pre 后 Flutter 代码无法编译
- android - 删除按钮上的按钮 Kotlin
- python - /accounts/login/ 'CustomLoginForm' 对象的 AttributeError 没有属性 'email_field'
- php - Wordpress 自定义表单发布以将数据发送到另一个页面
- finite-automata - 包含 1011 作为子字符串的 DFA