Hello,
I am working on the migration from a Postgresql database to Dgraph. We need to store geographic data.
I encounter a problem with geo functions. My queries return some results which they should not.
Here are my test set:
{
set {
_:a <name> "A" .
_:a <loc> "{'type': 'Polygon', 'coordinates': [[[ 2.57080078125, 51.04139389812637 ], [ -4.89990234375, 48.45835188280866 ], [ -1.9335937499999998, 43.34116005412307 ], [ 3.3837890625, 42.261049162113856 ], [ 7.536621093749999, 43.8186748554532 ], [ 8.173828125, 49.009050809382046 ], [ 2.57080078125, 51.04139389812637 ]]]}"^^<geo:geojson> .
_:b <name> "B" .
_:b <loc> "{'type': 'Polygon', 'coordinates': [[[ 138.25195312499997, -10.40137755454354 ], [ 111.533203125, -24.926294766395582 ], [ 116.3671875, -35.532226227703376 ], [ 149.501953125, -38.13455657705412 ], [ 154.072265625, -26.588527147308614 ], [ 138.25195312499997, -10.40137755454354 ]]] }"^^<geo:geojson> .
_:c <name> "C" .
_:c <loc> "{'type': 'Polygon', 'coordinates': [[[105.701,-10.511],[105.683,-10.474],[105.645,-10.466],[105.629,-10.437],[105.655,-10.415],[105.715,-10.384],[105.737,-10.384],[105.751,-10.394],[105.752,-10.484],[105.736,-10.505],[105.701,-10.511],[105.701,-10.511]]]}"^^<geo:geojson> .
}
}
and my query:
{
node(func: contains(loc, [2.5, 46.0])) {
uid
name
loc
}
}
I have tried in Dgraph 1.0.17 and 1.1.0 for the same results: this query returns polygons A and C instead of polygon A only as I am expecting.
Could you please advice?