import logging


def _get_areas(params, feature_names):
  """Returns mapping between areas and constituent feature types."""
  areas = {}
  for feature_id in range(len(params)):
    feature_info = params[feature_id]
    feature = feature_info["ID"]
    area = feature_info["Area"]
    if area not in areas:
      areas[area] = [feature]
    else:
      areas[area].append(feature)

    # Update the mapping from ID to name.
    feature_names[feature]["Name"] = feature_info["Name"]

  logging.info("Collected %d areas (%s).", len(areas), ",".join(areas.keys()))
  return areas