function insideBoundingBox (location, boundingBox) {
  const lat = getLatitude(location)
  const lon = getLongitude(location)

  const topLeftLon = getLongitude(boundingBox.topLeft)
  const topLeftLat = getLatitude(boundingBox.topLeft)
  const bottomRightLon = getLongitude(boundingBox.bottomRight)
  const bottomRightLat = getLatitude(boundingBox.bottomRight)
  
  const minLat = Math.min(topLeftLat, bottomRightLat)
  const maxLat = Math.max(topLeftLat, bottomRightLat)
  const minLon = Math.min(topLeftLon, bottomRightLon)
  const maxLon = Math.max(topLeftLon, bottomRightLon)

  return lon >= minLon && lon <= maxLon && lat >= minLat && lat <= maxLat
}
/**
 * Test whether a location lies inside a given bounding box.
 * @param {Location} location
 * @param {BoundingBox} boundingBox
 *            A bounding box containing a top left and bottom right location.
 *            The order doesn't matter.
 * @return {boolean} Returns true when the location is inside the bounding box
 *                   or on the edge.
 */
Test whether a location lies inside a given bounding box.
@param {Location} location
@param {BoundingBox} boundingBox
A bounding box containing a top left and bottom right location.
The order doesn't matter.
@return {boolean} Returns true when the location is inside the bounding box
or on the edge.
Test whether a location lies inside a given bounding box . @param { Location } location @param { BoundingBox } boundingBox A bounding box containing a top left and bottom right location . The order doesn ' t matter . @return { boolean } Returns true when the location is inside the bounding box or on the edge .
function insideBoundingBox (location, boundingBox) {
  const lat = getLatitude(location)
  const lon = getLongitude(location)
  const topLeftLon = getLongitude(boundingBox.topLeft)
  const topLeftLat = getLatitude(boundingBox.topLeft)
  const bottomRightLon = getLongitude(boundingBox.bottomRight)
  const bottomRightLat = getLatitude(boundingBox.bottomRight)
  const minLat = Math.min(topLeftLat, bottomRightLat)
  const maxLat = Math.max(topLeftLat, bottomRightLat)
  const minLon = Math.min(topLeftLon, bottomRightLon)
  const maxLon = Math.max(topLeftLon, bottomRightLon)
  return lon >= minLon && lon <= maxLon && lat >= minLat && lat <= maxLat
}
function insideBoundingBox ( location , boundingBox ) { const lat = getLatitude ( location ) const lon = getLongitude ( location ) const topLeftLon = getLongitude ( boundingBox . topLeft ) const topLeftLat = getLatitude ( boundingBox . topLeft ) const bottomRightLon = getLongitude ( boundingBox . bottomRight ) const bottomRightLat = getLatitude ( boundingBox . bottomRight ) const minLat = Math . min ( topLeftLat , bottomRightLat ) const maxLat = Math . max ( topLeftLat , bottomRightLat ) const minLon = Math . min ( topLeftLon , bottomRightLon ) const maxLon = Math . max ( topLeftLon , bottomRightLon ) return lon >= minLon && lon <= maxLon && lat >= minLat && lat <= maxLat }
Test whether a location lies inside a given bounding box.
Test whether a location lies inside a given bounding box .