Skip to content

A npm package to check if a geo-coordinate point is within a cirlce, given its geographical center (latitude and longitude) and the radius. The function can take in Geo-Coordinates and can be used to test if a point is in a particular GeoFence or a Geoboundary

Notifications You must be signed in to change notification settings

nxncode/geo-point-in-circle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Points In Circle (GeoFence/GeoBountry) This Package helps in finding if a geo coordinate provided is located inside a circle. This can be used to check if a particular point is within or outside a circular GeoFence/GeoBountry.

Installation

npm install --save geo-point-in-circle

Usage

Parameters

The package takes in three inputs parameters.

  1. Latitude of the point to be checked.
  2. Longitude of the point to be checked.
  3. An object which holds the latitude, longitude of the center of the circle, and radius of the circle in km

Return Object

The package returns an object that has a "result" boolean - true or false and distanceFromCenter the distance of the point from the center of the circle . If the point is within the cirlce, it returns true, else will return false.

Example

const checkPoint = require("geo-point-in-circle");
    
circle = { 
    circleLat : 20.5937,
    circleLng : 78.9629,
    circleRadius : 120
}

console.log(checkPoint(20.902 , 79.9629 , circle));

The above will return the result as

{ 
	result: true, 
	distanceFromCenter: 109.48865971794584
}

About

A npm package to check if a geo-coordinate point is within a cirlce, given its geographical center (latitude and longitude) and the radius. The function can take in Geo-Coordinates and can be used to test if a point is in a particular GeoFence or a Geoboundary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published