北纬180,纬度68.9636,Mongo错误 "越界"

问题描述 投票:0回答:1

在MongoDB上得到以下错误。

error MongoError: longitude/latitude is out of bounds, lng: 180 lat: 68.9636
...
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1590391393 },
ok: 0,
errmsg: 'longitude/latitude is out of bounds, lng: 180 lat: 68.9636',
code: 2,
codeName: 'BadValue',
'$clusterTime': {
  clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1590391393 },
  signature: { hash: [Binary], keyId: 0 }
},
name: 'MongoError',
[Symbol(mongoErrorContextSymbol)]: {}

然而,边界应该是有效的。

如果指定经纬度坐标,请先列出经度,再列出纬度。

有效的经度值是在-180和180之间,两者都包含在内。有效的纬度值在-90和90之间,两者都包含在内。

https:/docs.mongodb.commanualreferencegeojson)。

作为参考,我的查询是

Profiles.find(
  {
    'features.geometry': {
      $geoIntersects: {
        $geometry: geometry
      }
    }
  }
).fetch()

(使用Meteor)

geometry 甚至可以显示。https:/gist.github.comoleg13119b17e25670d6a54a176a5c670fd9ce5。

有谁见过这种看似有效的坐标的错误吗?

mongodb geojson
1个回答
0
投票

原来有些地物的经度 稍微 高于180,在错误回溯中显示时被四舍五入到180。

© www.soinside.com 2019 - 2024. All rights reserved.