Now in GraphQL Engine: Native support for PostGIS topology operators

23 January, 2019 | 1 min read

A lot of the developers in the Hasura GraphQL Engine community use PostGIS, the popular spatial database extension for Postgres, for their apps, and it was only natural for them to expect first-class support for PostGIS topology operators like ST_Contains, ST_Within, ST_DWithin, etc. in Hasura’s GraphQL API. We are very pleased to announce the availability of native support for these operators as boolean GraphQL operators!

Using PostGIS topology operators in GraphQL

Let’s say you want to fetch a list of popular landmarks within a district/borough. In your database schema you have a table called  landmarks (a list of popular locations, with a column of type geometry called location) and you need to search landmarks that are within a polygon (how you may model a district/borough). This is how you can now implement this search in a query using PostGIS’ ST_Within operator as a boolean GraphQL operator in the where argument:

You’ll have to pass the variable as JSON (GeoJSON ) representation of geometry values as shown below:

You can use these operators in subscriptions and mutations too.

List of supported PostGIS topology operators

The following is a list of all supported topology operators:

We are all ears!

We are huge fans of the PostGIS extension and very excited to contribute to the experience for developers using both PostGIS  and GraphQL Engine. We'd love to hear your thoughts on this release - please do try it out and let us know how we can further improve our PostGIS support.


Get Started with GraphQL Now

Hasura Cloud gives you a fully managed, production ready GraphQL API as a service to help you build modern apps faster.



The Hasura GraphQL Engine gives you realtime, high performance GraphQL on any Postgres app. Now supports event triggers for use with serverless.

Read More

Ready to get started?
Start for free on Hasura Cloud or you could contact our sales team for a detailed walk-through on how Hasura may benefit your business.
Get monthly product updates
Sign up for full access to our community highlights, new features, and occasional baby animal gifs! Oh, and we have a strict no-spam rule. ✌️