Mongo 错误 "out of bounds" 对于 lng 180,lat 68.9636
Mongo error "out of bounds" for lng 180, lat 68.9636
在 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)]: {}
但是,边界应该是有效的:
If specifying latitude and longitude coordinates, list the longitude
first and then latitude:
Valid longitude values are between -180 and 180, both inclusive. Valid
latitude values are between -90 and 90, both inclusive.
https://docs.mongodb.com/manual/reference/geojson/
作为参考,我的查询是
Profiles.find(
{
'features.geometry': {
$geoIntersects: {
$geometry: geometry
}
}
}
).fetch()
(使用流星)
甚至可以显示geometry
:
https://gist.github.com/oleg131/19b17e25670d6a54a176a5c670fd9ce5
有没有人看到这个看似有效坐标的错误?
原来某些要素的经度略高于 180,在错误回溯中显示时四舍五入为 180。
在 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)]: {}
但是,边界应该是有效的:
If specifying latitude and longitude coordinates, list the longitude first and then latitude:
Valid longitude values are between -180 and 180, both inclusive. Valid latitude values are between -90 and 90, both inclusive.
https://docs.mongodb.com/manual/reference/geojson/
作为参考,我的查询是
Profiles.find(
{
'features.geometry': {
$geoIntersects: {
$geometry: geometry
}
}
}
).fetch()
(使用流星)
甚至可以显示geometry
:
https://gist.github.com/oleg131/19b17e25670d6a54a176a5c670fd9ce5
有没有人看到这个看似有效坐标的错误?
原来某些要素的经度略高于 180,在错误回溯中显示时四舍五入为 180。