Geo near query not getting all results


(Michael) #1

I am trying a near() query with a 10,000Km radius and not getting all the nodes I expect. I verified that these co-ordinates are all valid and in the US (2 in Florida and 1 in Alabama). q1 contains all results that match a string search, and q2 is the same search but with an additional geo constraint.

QUERIES

{  
    q1(func: anyofterms(name, "Indian")) @cascade {
        uid
	geo.loc
    }

    q2(func: anyofterms(name, "Indian")) @filter(near(geo.loc, [-80.9956105,29.1383165], 10000)){
	 uid
	geo.loc
    }
}

RESULTS

{
  "data": {
    "q1": [
      {
        "uid": "0x282f",
        "geo.loc": {
          "type": "Point",
          "coordinates": [
            -80.9956105,
            29.1383165
          ]
        }
      },
      {
        "uid": "0x2901",
        "geo.loc": {
          "type": "Point",
          "coordinates": [
            -80.72698539999999,
            28.3164498
          ]
        }
      },
      {
        "uid": "0x2af5",
        "geo.loc": {
          "type": "Point",
          "coordinates": [
            -86.6072054,
            33.1781718
          ]
        }
      }
    ],
    "q2": [
      {
        "uid": "0x282f",
        "geo.loc": {
          "type": "Point",
          "coordinates": [
            -80.9956105,
            29.1383165
          ]
        }
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 754900,
      "processing_ns": 33240400,
      "encoding_ns": 12150000
    },
    "txn": {
      "start_ts": 26940
    }
  }
}

(Daniel Mai) #2

near(pred, [long, lat], 10000) is 10 kilometers, not 10,000 kilometers. Units are in meters.


(Michael) #3

Yes, thanks, I misread the docs as km.