在mongoDB中搜索多边形内的序列点

时间:2018-11-14 19:43:35

标签: mongodb geospatial polygon geojson

我必须检查mongodb查询的性能。我有两个文件。其中之一包含600个多边形。第二个包含10,000个随机生成的点。两者都位于两个单独的集合中(集合名称:沼泽,tenkpoints)。我想检查多边形中包含哪些点。在mongodb中有可能吗?

多边形(初始片段):

{
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        }
    },
    "features": [{
            "type": "Feature",
            "properties": {
                "cat": 1.0,
                "F_CODEDESC": "Marsh\/Swamp",
                "F_CODE": "BH095",
                "AREAKM2": 1263.08
            },
            "geometry": {
                "type": "Polygon",
                "coordinates": [a lot of coordinates...]
            }
        }, {
        "type": "Feature",
        "properties": {
            "cat": 3.0,
            "F_CODEDESC": "Marsh\/Swamp",
            "F_CODE": "BH095",
            "AREAKM2": 106.636
        },
        "geometry": {
            "type": "Polygon",
            "coordinates": [a lot of coordinates...]
        }

点(初始片段):

{
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        }
    },
    "features": [{
            "type": "Feature",
            "properties": {
                "id": 0
            },
            "geometry": {
                "type": "Point",
                "coordinates": [179.983784353492439, 56.255560445919222]
            }
        }, {
            "type": "Feature",
            "properties": {
                "id": 1
            },
            "geometry": {
                "type": "Point",
                "coordinates": [-139.248266199253635, 62.136903403842986]
            }
        }

0 个答案:

没有答案