Chapter5- PosgreSQL geometric primitives and nested dictionaries

In the PostgresSQL database description, there is reference to using Postgres native support for geometric primitives and the ability to save nested types as dictionaries. I have searched via Google and directly on the Vapor site for examples of how this would be done but to no avail. Specifically I would like to be able to store locations as coordinates and have the ability to query for locations within a certain distance from a coordinate. Any good references would be appreciated.

PS. Great book and examples. It has answered a number of questions I was having even after watching the video tutorial… I would consider this a must read for anyone starting with Vapor.

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @earmand, take a look at as that may help you achieve what you need.

For doing queries with coordinates, you’re probably doing to have to drop down to raw SQL. The best bet would be to join the Discord channel and ask in there as some people may have done what you are trying to do!

Thanks Tim for the references and the great book!