/**
 * 坐标集合的最西南角
 * @param {*} list
 *  list 是接口获取的点 的数组
 */
export const getSW = (list) => {
  let south = null
  let west = null
  for (let item of list) {
    if ((west && item.lnglat.lng < west) || !west) {
      west = item.lnglat.lng - 0.7
    }
    if ((south && item.lnglat.lat < south) || !south) {
      south = item.lnglat.lat - 0.7
    }
  }
  return [west, south]
}

/**
 *  最东北角
 * @param {*} list
 */
export const getNE = (list) => {
  let north = null
  let east = null
  for (let item of list) {
    if ((east && item.lnglat.lng > east) || !east) {
      east = item.lnglat.lng + 0.7
    }
    if ((north && item.lnglat.lat > north) || !north) {
      north = item.lnglat.lat + 0.7
    }
  }

  return [east, north]
}
