使用Python从Geojson中提取坐标

2024-05-03 18:09:44 发布

您现在位置:Python中文网/ 问答频道 /正文

考虑以下pymongo代码:

location = db.BLR_all.find_one( { "$and": [{"geom.type":"Point"},{"REGION": "KORAMANGALA"},{"E_NAME": "RAILWAY BOOKING CENTER"}] })

打印位置时,值为:

^{pr2}$

以及

>>> print(location["geom"])

会给出以下输出

{'coordinates': [77.6221694946289, 12.93125057220459], 'type': 'Point'}

不管怎样,我能提取坐标并打印出来吗?

我期望的输出是:

[77.6221694946289, 12.93125057220459]

谢谢。


Tags: and代码namedbtypelocationallfind