krishnas
krishnas

Reputation: 23

I need to check the marker is inside the polygon on map in flutter

I create map, where as user can draw the boundaries(polygon) of his area, and give exact geo-location by placing pin(marker). but my problem is that when i create this before it check the marker is inside the polygon or not.

image description here

Upvotes: 1

Views: 1211

Answers (2)

Sergey Kashin
Sergey Kashin

Reputation: 1

No need to use ext libraries

        Polygon poly = ....;
        onTap: (tapPosition,latlng) {
          setState(() {
              if(poly.boundingBox.contains(latlng)){
                log("point inside the edge")
              }
          });
        },

Upvotes: 0

Tofiq Samali
Tofiq Samali

Reputation: 339

You can use point_in_polygon package and simply pass your point and point of polygon.

Poly.isPointInPolygon(pointToCheckIfInPolygon, pointsOfPolygon)

Upvotes: 1

Related Questions