我想拥有一个带有多边形的集合(地球上的某些区域),并且考虑到我有一个点(地球上的一个地方),我想知道哪些多边形包含这一点。
考虑像这样的集合。
{
"_id" : "xxx",
"geo" : {
"type" : "MultiPolygon",
"coordinates" : [
[
[
[
34.5245361328125,
26.4386062678873
],
[
34.5327758789062,
26.4754901967738
],
[
34.5272827148438,
26.5099045314139
],
[
34.508056640625,
26.5688765479507
],
[
34.5135498046875,
26.6376388866459
],
[
34.5053100585938,
26.7210803908617
],
[
34.4943237304688,
26.7872992221561
],
[
34.5135498046875,
26.8608304092814
],
[
34.5382690429688,
26.9587976785709
],
[
34.5767211914062,
27.08113703389
],
[
34.595947265625,
27.2741611173747
],
[
34.5492553710938,
27.3766453536396
],
[
34.12353515625,
27.5448063177539
],
[
33.59893798828125,
27.94467306257741
],
[
33.6676025390625,
27.51314343580719
],
[
33.5577392578125,
27.3912773132324
],
[
33.4588623046875,
27.3351745605469
],
[
33.4259033203125,
27.2326526641846
],
[
33.4121704101562,
27.1300354003906
],
[
33.4808349609375,
27.0077495574951
],
[
33.5467529296875,
26.8804302215576
],
[
33.6044311523438,
26.7382526397705
],
[
33.6758422851562,
26.5664196014404
],
[
33.7197875976562,
26.4090900421143
],
[
33.760986328125,
26.2712516784668
],
[
33.81591796875,
26.1505069732666
],
[
33.8818359375,
26.0937881469727
],
[
33.9669799804688,
26.1381797790527
],
[
34.0713500976562,
26.2318382263184
],
[
34.1372680664062,
26.2540092468262
],
[
34.1867065429688,
26.2663249969482
],
[
34.2333984375,
26.2761764526367
],
[
34.27734375,
26.2811031341553
],
[
34.3927001953125,
26.3081885431537
],
[
34.4833374023438,
26.3451141501178
],
[
34.5245361328125,
26.4066306425568
],
[
34.5245361328125,
26.4386062678873
]
],
...
]
]
}
}
我如何实现这一目标?
db['countries'].find( {
"geo.coordinates" : {
$geoIntersects : {
$geometry : {
type : "Point" ,
coordinates : [
34.5245361328125,
26.4386062678873
]
}
}
}
})