考虑以下pymongo代码:
location = db.BLR_all.find_one( { "$and": [{"geom.type":"Point"},{"REGION": "KORAMANGALA"},{"E_NAME": "RAILWAY BOOKING CENTER"}] })
当我打印位置时,值为:
>>> print(location)
{'FAX': '_', 'EMAIL': '_', 'CATEGORY': 'TRANSPORTATION', 'REGION': 'KORAMANGALA', 'TELEPHONE': '_', 'geom': {'coordinates': [77.6221694946289, 12.93125057220459], 'type': 'Point'}, '_id': ObjectId('5343a31ea6e10b1c40e7d7bd'), 'E_NAME': 'RAILWAY BOOKING CENTER', 'LAYER_NAME': 'Facility', 'PINCODE': '_', 'WEBSITE': '_', 'CE_NO': '_', 'ID': 2.0, 'ROAD_NAME': '17TH MAIN ROAD', 'SUB_CAT': 'BOOKING CENTER'}
和
>>> print(location["geom"])
将提供以下输出
{'coordinates': [77.6221694946289, 12.93125057220459], 'type': 'Point'}
无论如何,我是否可以提取坐标并打印出来?
我期待的输出是:
[77.6221694946289, 12.93125057220459]
谢谢。