简体   繁体   中英

Detect region based on geo location

I have a json file with lists of regions.

Each region has geo border points like:

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], ...

How can I detect region based on some location using js, C# or any google service?

You can use the containsLocation method from the Google Maps JavaScript API Geometry Library . From the documentation :

containsLocation(point:LatLng, polygon:Polygon)

Return Value: boolean

Computes whether the given point lies inside the specified polygon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM