使用python从geojson中提取坐标

时间:2014-04-17 13:31:03

标签: python mongodb gis pymongo

考虑以下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]

谢谢。

0 个答案:

没有答案