Why doesn't dgraph support LineString type in geo spatial?

Dgraph seems just support Point, Polygon, and MultiPolygon now.

1 Like

The system can only index those 3, (see note here). I believe further support for indexing more geo types would be a good feature request for you to create.

The underlying library used supports:

Point
LineString
Polygon
MultiPoint
MultiLineString
MultiPolygon
GeometryCollection

Is it a Geometry type of Geography type that supported in dgraph?

The index is geographic in nature. I had a use case where I wanted to use it for geometry and the index led to very wrong results from large values. The index is built assuming values around that of latitude and longitude.

1 Like

So dgraph doesn’t support geometry now?
I found that when cockroachdb build google s2 index on geometry value, it will convert geometry value to geography value first.

The index is built around values around lat,long sizing. Other size values will work but you will get inaccurate results from geo comparison functions.

The actual storage and querying of the geo values will work just fine whatever the values are.

Also note that custom tokenizers can be loaded into dgraph if you are self-hosting it, and that can give you the ability to create indicies correctly. You will just use anyof or allof instead of intersects or contains.

I found the library you refered is go-geom, which is a geometry(not geography) library. The actual library used by dgraph is s2.

Right, I linked that library and said as such in my original reply.