Ratel Point Location not shown correctly in Geo Tab

Hi Folks,
I recently deployed Dgraph in production in our Organization(GoJek/GoTo), and it’s really working well for us. I am currently facing an issue while using Dgraph Ratel (latest). While querying the point location data, I want to see it mapped into Geo Tab of the UI. But currently, it doesn’t show it correctly.
Here is the sample data:

{
  "data": {
    "node": [
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.283551,
            112.6789635
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2054482,
            113.2519578
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2064759,
            113.2519137
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2736745,
            112.683357
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2029214,
            113.2498783
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2076692,
            113.2530302
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2834917,
            112.6789961
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2577314,
            112.6477523
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835912,
            112.6789742
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2064759,
            113.2519137
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835495,
            112.6789655
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2834623,
            112.6789715
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2064759,
            113.2519137
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.273525,
            112.6831765
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2070905,
            113.2530418
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2054761,
            113.2522589
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2836572,
            112.6788511
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2076692,
            113.2530302
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835827,
            112.6789431
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2836218,
            112.6788218
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.283551,
            112.6789635
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2837332,
            112.6790435
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2836129,
            112.6786464
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2076692,
            113.2530302
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835693,
            112.6790351
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2738247,
            112.6603553
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2834237,
            112.6784343
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.0590391,
            112.7943516
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.283551,
            112.6789635
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835084,
            112.6788298
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2029478,
            113.2498898
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.20537,
            113.2523317
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2736126,
            112.6832642
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2834783,
            112.6788974
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835697,
            112.6789588
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2064759,
            113.2519137
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2835822,
            112.6790467
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2053473,
            113.2520368
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2067641,
            113.2523103
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.28357,
            112.678955
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.28357,
            112.678955
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.27393,
            112.6603
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.27393,
            112.6603
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.2055182,
            113.25224
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.205699,
            113.25174
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.205699,
            113.25174
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.205699,
            113.25174
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.205699,
            113.25174
          ]
        }
      },
      {
        "location": {
          "type": "Point",
          "coordinates": [
            -7.205699,
            113.25174
          ]
        }
      }
    ]
  }
}

and corresponding image shown in Geo tab:


This doesn’t seem to be correct, because I checked a few of these locations on internet as well and this seems to be correct.

1 Like

Can you invert the coordinates? just to check. I think some geo data comes inverted in relation to Dgraph’s standard.

Data is already ingested, is there a way to invert in query?

Nope.

Dgraph uses the GeoJSON standard where Points are defined as [longitude, latitude]. It looks like your data is in [latitude, longitude]. The visualization will be correct once your data is set in the right format.

Dumb question,
What if I change map data i.e. revert coordinates in

as temporary fix? Will it work theoretically?

Is that a raw.githubusercontent.com URL you wanted to share? I’m not able to see it so I don’t know what the data looks like.

oh, my bad. Here is the map url: https://raw.githubusercontent.com/zcreativelabs/react-simple-maps/master/topojson-maps/world-110m.json

If the points are in [latitude, longitude] format, then yes, reversing the coordinates would work.