PHPackages                             msurkov16/sb-polygon-pointer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. msurkov16/sb-polygon-pointer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

msurkov16/sb-polygon-pointer
============================

Simple PHP class that provides tools to define is a point (latitude/longitude) is inside the polygon

1.1.0(2y ago)013MITPHPPHP &gt;=7.4

Since Mar 7Pushed 2y agoCompare

[ Source](https://github.com/MSurkov16/sb-polygon-pointer)[ Packagist](https://packagist.org/packages/msurkov16/sb-polygon-pointer)[ Docs](https://github.com/MSurkov16/sb-polygon-pointer)[ RSS](/packages/msurkov16-sb-polygon-pointer/feed)WikiDiscussions master Synced today

READMEChangelog (4)DependenciesVersions (5)Used By (0)

sb-polygon-pointer
==================

[](#sb-polygon-pointer)

Simple PHP class that provides tools to define is a point (latitude/longitude) is inside the polygon

See the example at example.php

Install
-------

[](#install)

Via Composer

```
$ composer require msurkov16/sb-polygon-pointer
```

#### Init custom polygon

[](#init-custom-polygon)

```
$polygonBox = [
    [55.761515, 37.600375],
    [55.759428, 37.651156],
    [55.737112, 37.649566],
    [55.737649, 37.597301],
];

$sbPolygonEngine = new sbPolygonEngine($polygonBox);
```

#### Checking if point is inside polygon

[](#checking-if-point-is-inside-polygon)

```
$isCrosses = $sbPolygonEngine->isCrossesWith(55.746768, 37.625605);

// $isCrosses is boolean
```

#### Visualization of polygon and provided point to check

[](#visualization-of-polygon-and-provided-point-to-check)

```
$sbPolygonEngine->previewBounds($draw_perpendicular = true, $draw_center_dot = true);
// it will return an
