“MongoError:无法从对象中提取地理键";类型:点 [英] "MongoError: Can't extract geo keys from object" with Type : Point

查看:16
本文介绍了“MongoError:无法从对象中提取地理键";类型:点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为我的数据库字段准备地理编码:

I try to prepare my database field for geocoding with this:

MyCollection._ensureIndex({'data.address.located':'2dsphere'});

但是这个错误来了:

MongoError: Can't extract geo keys from object, malformed geometry?:
{ type: "Point", coordinates: [ 32.4586858, -110.8571443 ] }

我看不出这个字段有什么问题?有什么想法吗?

I can not see whats wrong with this field ? Any idea ?

当我查看this时,它显示了:

When I take a look to this it shows up this:

The following example stores a GeoJSON Point:

{ loc: { type: "Point", coordinates: [ 40, 5 ] } }

推荐答案

问题在于

[ 32.4586858, -110.8571443 ]

不是有效坐标.顺序应该是经度,然后是纬度,而该坐标似乎是相反的(从有效纬度范围是 -90 到 90 并且 -110.8571443 不在此范围内判断).

is not a valid coordinate. The order should be longitude followed by latitude whereas that coordinate appears to be the reverse (judging by the fact that the valid latitude range is -90 to 90 and -110.8571443 is outside of that).

我想你的意思是:

{ type: "Point", coordinates: [ -110.8571443, 32.4586858 ] }

或者有其他一些输入错误.

or there was some other entry error.

这篇关于“MongoError:无法从对象中提取地理键";类型:点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆