gpt4 book ai didi

javascript - 根据地理位置检测区域

转载 作者:行者123 更新时间:2023-11-29 21:15:20 26 4
gpt4 key购买 nike

我有一个包含区域列表的 json 文件。

每个区域都有如下地理边界点:

id": "4650d7cc-b834-4ed4-a139-40f5037711fc",
"name": "region 1",
"coords": [
[
[4.74, 52.431],
[4.781, 52.426],
[4.831, 52.42],
[4.855, 52.417],
[4.862, 52.422],
[4.861, 52.425],
[4.866, 52.428], ...

如何使用 js、C# 或任何谷歌服务检测基于某个位置的区域?

最佳答案

您可以使用 Google Maps JavaScript API Geometry Library 中的 containsLocation 方法.来自 the documentation :

containsLocation(point:LatLng, polygon:Polygon)

Return Value: boolean

Computes whether the given point lies inside the specified polygon.

关于javascript - 根据地理位置检测区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39659964/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com