How to use the geolib.isPointInCircle function in geolib

To help you get started, we’ve selected a few geolib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github team-copper / captAR / component / Map.js View on Github external
onCapturePress() {

    let team = '';

    for (let i=0; i
github flyandi / react-native-maps-navigation / src / modules / Traps.js View on Github external
switch (trap.type) {

                    case TrapTypes.Types.CIRCLE:

                        if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {

                        }

                        break;

                    case TrapTypes.Types.STEP:

                        const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);

                        const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);

                        const stateMap = {
                            [TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
                            {
                                const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);

                                return insideOuter ? (isWithinCourse ? TrapTypes.Events.ENTERING_ON_COURSE : TrapTypes.Events.ENTERING_OFF_COURSE) : false;
                            }],

                            [TrapTypes.States.ENTERED]: [TrapTypes.States.INSIDE, () =>
                            {
                                return insideOuter ? TrapTypes.Events.INSIDE : false;
                            }],

                            [TrapTypes.States.INSIDE] : [TrapTypes.States.CENTER, () =>
                            {
github flyandi / react-native-maps-navigation / src / modules / Traps.js View on Github external
return traps.map(index => {

            const trap = this.traps[index];

            if(trap.state != TrapTypes.States.EXPIRED) {

                switch (trap.type) {

                    case TrapTypes.Types.CIRCLE:

                        if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {

                        }

                        break;

                    case TrapTypes.Types.STEP:

                        const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);

                        const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);

                        const stateMap = {
                            [TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
                            {
                                const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);
github SignalK / signalk-server-node / lib / subscriptionmanager.js View on Github external
function checkPosition (app, context, normalizedDeltaData) {
  var vessel = _.get(app.signalk.root, normalizedDeltaData.context)
  var position = _.get(vessel, 'navigation.position')

  var subsPosition = _.get(context, 'position')
  if (
    position &&
    position.value &&
    position.value.latitude &&
    position.value.longitude &&
    subsPosition &&
    subsPosition.latitude &&
    subsPosition.longitude
  ) {
    return geolib.isPointInCircle(position.value, subsPosition, context.radius)
  }

  return false
}
github hackclub / finder / src / hotspots.js View on Github external
filter: club =>
      isPointInCircle(
        club,
        { latitude: 37.641045, longitude: -122.228916 },
        fromMiles(39)
      ),
    slug: 'bay-area'
github hackclub / finder / src / hotspots.js View on Github external
filter: club =>
      club.parsed_city === 'Los Angeles' ||
      isPointInCircle(
        club,
        { latitude: 34.075365, longitude: -118.390819 },
        fromMiles(20)
      )
  },
github hackclub / finder / src / utils.js View on Github external
  points.filter(point => isPointInCircle(point, center, radius))
github flyandi / react-native-maps-navigation / src / modules / Traps.js View on Github external
if(trap.state != TrapTypes.States.EXPIRED) {

                switch (trap.type) {

                    case TrapTypes.Types.CIRCLE:

                        if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {

                        }

                        break;

                    case TrapTypes.Types.STEP:

                        const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);

                        const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);

                        const stateMap = {
                            [TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
                            {
                                const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);

                                return insideOuter ? (isWithinCourse ? TrapTypes.Events.ENTERING_ON_COURSE : TrapTypes.Events.ENTERING_OFF_COURSE) : false;
                            }],

                            [TrapTypes.States.ENTERED]: [TrapTypes.States.INSIDE, () =>
                            {
                                return insideOuter ? TrapTypes.Events.INSIDE : false;
                            }],

geolib

Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc. This library is currently **2D**, meaning that altitude/elevation is not yet supported by any of its functions!

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis