PostgreSQL has a special datatype to store geometric data called point. It is used to represent a point in a two-dimensional space. The point datatype is represented as a pair of (x, y) coordinates.
The point expects to receive longitude first, followed by latitude.
This is how you can create table with point datatype in Drizzle:
This is how you can insert point data into the table in Drizzle:
To compute the distance between the objects you can use <-> operator. This is how you can query for the nearest location by coordinates in Drizzle:
To filter rows to include only those where a point type location falls within a specified rectangular boundary defined by two diagonal points you can user <@ operator. It checks if the first object is contained in or on the second object: