Geolocation List

Hey @MichelDiz

List type should work with geo. I tried with the following schema and mutations.

loc: [geo] @index(geo) .
{
  set {
    <_:0xeb1dde9c> <loc> "{'type':'Point','coordinates':[-122.4220186,37.772318]}"^^<geo:geojson> .
    <_:0xeb1dde9c> <loc> "{'type':'Point','coordinates':[-123.4220186,38.772318]}"^^<geo:geojson> .
  }
}

The I ran this query

{
  me(func: uid(0x1)) {
    loc
  }
}

And got expected results

{
  "data": {
    "me": [
      {
        "loc": [
          {
            "type": "Point",
            "coordinates": [
              -122.4220186,
              37.772318
            ]
          },
          {
            "type": "Point",
            "coordinates": [
              -123.4220186,
              38.772318
            ]
          }
        ]
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 10792,
      "processing_ns": 44677,
      "encoding_ns": 390974
    },
    "txn": {
      "start_ts": 7,
      "lin_read": {
        "ids": {
          "1": 7
        }
      }
    }
  }
}
1 Like