使用 php 检查多边形 geojson 中的点是否位于内部

check if point inside or not in multipolygon geojson with php

我有像这样的多边形点的 geojson

"geometry": {
    "type": "MultiPolygon",
    "coordinates": [
        [
            [
                [
                    97.11917877197294,
                    2.113018035888672
                ],
                [
                    97.15389251709013,
                    2.086940050125179
                ],
                [
                    97.11464691162126,
                    2.0038630962372395
                ],
                [
                    97.07888793945335,
                    2.0861101150512695
                ],
                [
                    97.11917877197294,
                    2.113018035888672
                ]
            ]
        ],
        [
            [
                [
                    97.2437820434572,
                    2.2361090183258625
                ],
                [
                    97.33863830566412,
                    2.1651189327241127
                ],
                [
                    97.35886383056646,
                    2.0827920436860268
                ],
                [
                    97.31186676025408,
                    2.0578811168671223
                ],
                [
                    97.21376800537138,
                    2.1765921115875813
                ],
                [
                    97.11254882812517,
                    2.214848995208797
                ],
                [
                    97.2437820434572,
                    2.2361090183258625
                ]
            ]
        ],
        [
            [
                [
                    95.80278015136736,
                    2.9305601119996254
                ],
                [
                    96.03083038330107,
                    2.75694394111639
                ],
                [
                    96.1138916015625,
                    2.739722967147941
                ],
                [
                    96.10743713378912,
                    2.6363189220428467
                ],
                [
                    96.17388916015653,
                    2.6738901138305664
                ],
                [
                    96.25332641601562,
                    2.585560083389339
                ],
                [
                    96.40838623046875,
                    2.511549949646053
                ],
                [
                    96.47194671630865,
                    2.451111078262329
                ],
                [
                    96.49810028076195,
                    2.3621609210968586
                ],
                [
                    96.44374847412115,
                    2.328478097915763
                ],
                [
                    96.3180541992188,
                    2.3533339500427246
                ],
                [
                    96.31012725830095,
                    2.4228711128234863
                ],
                [
                    96.22938537597685,
                    2.4415690898895264
                ],
                [
                    96.07550811767572,
                    2.5694530010224526
                ],
                [
                    95.95471954345732,
                    2.5691659450532143
                ],
                [
                    95.86434936523449,
                    2.6364710330963703
                ],
                [
                    95.79194641113281,
                    2.63611102104187
                ],
                [
                    95.73472595214844,
                    2.755556106567383
                ],
                [
                    95.80278015136736,
                    2.9305601119996254
                ]
            ]
        ],
        [
            [
                [
                    96.23584747314459,
                    4.055531978607121
                ],
                [
                    96.14090728759777,
                    4.148777961731014
                ],
                [
                    96.02066802978521,
                    4.2103490829467205
                ],
                [
                    95.75129699707048,
                    4.496090888977108
                ],
                [
                    95.54023742675787,
                    4.670730113983154
                ],
                [
                    95.41124725341797,
                    4.82388782501215
                ],
                [
                    95.3655548095706,
                    5.0266671180726235
                ],
                [
                    95.29777526855474,
                    5.116112232208252
                ],
                [
                    95.30944824218756,
                    5.161940097808895
                ],
                [
                    95.2144470214846,
                    5.275279998779411
                ],
                [
                    95.25222015380882,
                    5.376390933990535
                ],
                [
                    95.1934738159182,
                    5.527058124542236
                ],
                [
                    95.27583312988287,
                    5.54666805267334
                ],
                [
                    95.43222045898438,
                    5.656943798065299
                ],
                [
                    95.50026702880876,
                    5.601941108703613
                ],
                [
                    95.61194610595726,
                    5.627779960632438
                ],
                [
                    95.88722229003935,
                    5.504170894622803
                ],
                [
                    95.9033432006836,
                    5.406389236450195
                ],
                [
                    96.07805633544922,
                    5.290554046630973
                ],
                [
                    96.26305389404297,
                    5.260831832885856
                ],
                [
                    96.41722106933616,
                    5.198890209197998
                ],
                [
                    96.50971984863287,
                    5.1994409561157795
                ],
                [
                    96.81250000000011,
                    5.263887882232723
                ],
                [
                    96.98719787597668,
                    5.26252985000616
                ],
                [
                    97.10362243652344,
                    5.224556922912598
                ],
                [
                    97.19916534423845,
                    5.14194297790533
                ],
                [
                    97.49722290039074,
                    5.250229835510368
                ],
                [
                    97.64472198486345,
                    5.075553894042969
                ],
                [
                    97.80926513671886,
                    4.932139873504639
                ],
                [
                    97.90165710449219,
                    4.88889122009283
                ],
                [
                    97.96437072753923,
                    4.678417205810604
                ],
                [
                    98.01380920410156,
                    4.61774396896368
                ],
                [
                    97.97229003906273,
                    4.560091018676758
                ],
                [
                    98.06594085693382,
                    4.553030967712459
                ],
                [
                    98.23750305175798,
                    4.458828926086369
                ],
                [
                    98.28028106689453,
                    4.331944942474365
                ],
                [
                    98.23779296875023,
                    4.287230968475399
                ],
                [
                    98.20121765136747,
                    4.304190158844051
                ],
                [
                    98.066879272461,
                    4.253109931945858
                ],
                [
                    98.02313232421892,
                    3.969779014587516
                ],
                [
                    97.8999099731447,
                    3.8914198875427246
                ],
                [
                    97.92320251464844,
                    3.8477001190186684
                ],
                [
                    97.80166625976557,
                    3.7178299427031902
                ],
                [
                    97.95562744140625,
                    3.4814200401305584
                ],
                [
                    97.94970703125017,
                    3.3915400505066486
                ],
                [
                    98.02742004394537,
                    3.3311500549317543
                ],
                [
                    97.92236328125028,
                    3.2287499904632
                ],
                [
                    97.98346710205095,
                    3.0839109420777504
                ],
                [
                    97.9392166137697,
                    3.0719408988953205
                ],
                [
                    97.95461273193371,
                    2.9015390872955322
                ],
                [
                    98.00679016113287,
                    2.88955998420721
                ],
                [
                    98.11132049560553,
                    2.7857000827789307
                ],
                [
                    98.08683776855486,
                    2.734899997711125
                ],
                [
                    98.12425994873047,
                    2.655121088028068
                ],
                [
                    98.07522583007812,
                    2.5755290985106853
                ],
                [
                    98.11209106445335,
                    2.424449920654297
                ],
                [
                    98.18766021728544,
                    2.319310903549308
                ],
                [
                    98.15334320068388,
                    2.146939992904663
                ],
                [
                    97.94860839843756,
                    2.270833969116268
                ],
                [
                    97.7827758789062,
                    2.2338891029359047
                ],
                [
                    97.66278076171886,
                    2.4000000953674316
                ],
                [
                    97.65083312988281,
                    2.668056011200065
                ],
                [
                    97.61055755615251,
                    2.844719886779899
                ],
                [
                    97.41583251953142,
                    2.9408340454100994
                ],
                [
                    97.31833648681635,
                    3.0527780056000324
                ],
                [
                    97.24407196044928,
                    3.2351610660554115
                ],
                [
                    97.17916870117188,
                    3.249722957611084
                ],
                [
                    97.00249481201189,
                    3.5462410449982826
                ],
                [
                    96.90343475341825,
                    3.602802038192806
                ],
                [
                    96.86277008056646,
                    3.6955509185791584
                ],
                [
                    96.77233886718756,
                    3.739048957824707
                ],
                [
                    96.53681945800804,
                    3.7305409908294678
                ],
                [
                    96.38664245605469,
                    3.8503909111024086
                ],
                [
                    96.23584747314459,
                    4.055531978607121
                ]
            ]
        ],
        [
            [
                [
                    95.05889129638666,
                    5.751111030578613
                ],
                [
                    95.14236450195318,
                    5.670001029968262
                ],
                [
                    95.05139160156256,
                    5.670833110809326
                ],
                [
                    95.05889129638666,
                    5.751111030578613
                ]
            ]
        ],
        [
            [
                [
                    95.21721649169939,
                    5.90778112411499
                ],
                [
                    95.28666687011736,
                    5.841942787170353
                ],
                [
                    95.32861328125017,
                    5.900834083557243
                ],
                [
                    95.37277984619146,
                    5.845831871032772
                ],
                [
                    95.28507232666044,
                    5.780276775360221
                ],
                [
                    95.21721649169939,
                    5.90778112411499
                ]
            ]
        ]
    ]
}

我需要检查给定的坐标点是否在avilabe区域内 示例 检查坐标点 4.585919718930924,97.19313601405156 是否在区域内

我找到了 javascript 和 turfjs

的解决方案

但我只希望在具有 php

的服务器上执行此过程

我找到了 php 的解决方案,但只适用于一维数组 https://assemblysys.com/php-point-in-polygon-algorithm/

更新

通过将 manualy turf js 转换为 php

解决了

通过将 manualy turf js 转换为 php

解决了