Namespace: mapUtil

aegir.mapUtil

Collection of map utility functions

Methods

(static) boundsContainsPoint(bounds, location) → {boolean}

Check if a point is within a geographic boundary
Parameters:
Name Type Description
bounds vmCoordinateBounds the rectangular bounds to check
location location the location to check
Since:
  • 1.2
Returns:
true if the point falls within the specified bounds, false otherwise
Type
boolean

(static) centerOfCoordinates(coordinates) → {number}

Finds the sw/ne of a list of coordinates, then calculates the center
Parameters:
Name Type Description
coordinates Array.<location> the list of coordinates
Since:
  • 1.2
Returns:
the center
Type
number

(static) coordinateBounds(coordinates) → {vmCoordinateBounds}

Finds the sw/ne of a list of coordinates
Parameters:
Name Type Description
coordinates Array.<location> the list of coordinates
Since:
  • 1.2
Returns:
the bounding box
Type
vmCoordinateBounds

(static) degreesToRadians(degrees)

Converts degrees to radians
Parameters:
Name Type Description
degrees number the degree value
Since:
  • 1.2
Returns:
value converted to radians

(static) distanceBetweenPoints(start, end)

Calculates the distance between two coordinates
Parameters:
Name Type Description
start location first coordinate
end location second coordinate
Since:
  • 1.2
Returns:
distance calculated in METERS

(static) headingBetweenPoints(p1, p2) → {number}

Calculates the heading (bearing) between two coordinates.
Parameters:
Name Type Description
p1 location the first coordinate
p2 location the second coordinate
Since:
  • 1.2
Returns:
calculated heading in DEGREES
Type
number

(static) pointIsInPolygon(pointnon-null, verticesnon-null) → {boolean}

Check if a point falls inside of a polygon or not
Parameters:
Name Type Description
point location the point to check
vertices Array.<location> the points that make up the polygon
Since:
  • 1.2
Returns:
true if the given point falls within the boundaries of the polygon
Type
boolean

(static) radiansToDegrees(radians)

Converts radians to degrees
Parameters:
Name Type Description
radians number the radian value
Since:
  • 1.2
Returns:
value converted to degrees

(static) unionOfCoordinateBounds(bounds) → {vmCoordinateBounds}

Combine multiple coordinate bounds into a single one
Parameters:
Name Type Description
bounds Array.<vmCoordinateBounds> a list of boudns to merge
Since:
  • 1.2
Returns:
the merged bounds
Type
vmCoordinateBounds