Skip to main content

polygon_checker 1.2.0 copy "polygon_checker: ^1.2.0" to clipboard
polygon_checker: ^1.2.0 copied to clipboard

A lightweight Dart utility to check whether a point lies inside polygon locations.

Polygon Checker #

A lightweight Dart utility to check whether a latitude/longitude coordinate lies inside or near specified polygon locations.

Features #

  • Strict Inside Check: Determine if a point is mathematically inside a polygon.
  • Proximity Check: Check if a point is within a specific distance (e.g., 50 meters) of a polygon boundary.
  • Location Retrieval: Get the full PolygonLocation object (ID, Name, Points) for the matched area.

Usage #

1. Simple Boolean Check #

Check if a user is strictly inside any office:

import 'package:polygon_checker/polygon_checker.dart';

bool isInside = PolygonChecker.isInsideAnyOfficePolygon(
  userLat,
  userLng,
  offices,
);

2. Proximity Check (with Radius) #

Check if a user is inside or within 50 meters of an office:

bool isNear = PolygonChecker.isInsideOrNearAnyOfficePolygon(
  userLat,
  userLng,
  offices,
  radiusInMeters: 50.0, // Optional, defaults to 50.0
);

3. Get Matched Location Details #

Retrieve the specific office details if a match is found:

PolygonLocation? location = PolygonChecker.getInsideOrNearOfficePolygon(
  userLat,
  userLng,
  offices,
  radiusInMeters: 50.0,
);

if (location != null) {
  print('Matched: ${location.locationName} (${location.locationId})');
}

Installation #

Add this to your pubspec.yaml:

dependencies:
  polygon_checker:
    path: ../polygon_checker # or version from pub.dev
0
likes
160
points
17
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight Dart utility to check whether a point lies inside polygon locations.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on polygon_checker