Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-27248

Provide a way to Calculate Centroid and Radius of Geo Records

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Aggregation Framework, Geo
    • Labels:
      None

      Description

      Consider the following use case:

      We are developing a new feature for our system that revolves displaying documents from the database on a map. We need to filter the documents by various criteria (not location) and then display the matching documents on a map.

      In order to choose the center and zoom level of the map, we need the centroid of the returned records, and the radius that would contain them. Is there a way to retrieve that information using aggregation framework, or do I need to pull all records from MongoDB and do the calculation on our end?

      It certainly seems like geoNear is the right solution for computing the distance on the last step so they can center their output, but there doesn't seem to be an easy way to do the centroid computation external to the pipeline and pass the resultant values into the geoNear call. Would it be feasible to remove that restriiction on geoNear so that it could be placed anywhere within an aggregation pipeline?

        Attachments

          Activity

            People

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            lorne.schachter Lorne Schachter
            Participants:
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: