我尝试使用以下方法准备我的数据库字段以进行地理编码:
MyCollection._ensureIndex({'data.address.located':'2dsphere'});
但是随后出现此错误:
MongoError: Can't extract geo keys from object, malformed geometry?:
{ type: "Point", coordinates: [ 32.4586858, -110.8571443 ] }
我看不出这个领域有什么问题?任何想法 ?
当我看 这个 时,它显示了这个:
The following example stores a GeoJSON Point:
{ loc: { type: "Point", coordinates: [ 40, 5 ] } }
原文由 TJR 发布,翻译遵循 CC BY-SA 4.0 许可协议
问题是
不是有效坐标。顺序应该是经度后跟纬度,而该坐标似乎是相反的(根据有效纬度范围是 -90 到 90 而 -110.8571443 超出该范围这一事实来判断)。
我想你的意思是:
或者有一些其他的输入错误。