---
title: "Geo Queries with PostGIS in Ionic Angular"
description: "PostGIS on Supabase handles geo data for an Ionic Angular app with a Capacitor Google Map."
url: "https://swe.quest/articles/geo-queries-with-postgis-in-ionic-angular-9afa3d65d6fa3030"
canonical: "https://supabase.com/blog/geo-queries-with-postgis-in-ionic-angular"
source: "Supabase"
published: "2023-03-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 20
tags: ["postgres","geospatial","mobile","frontend"]
---

# Geo Queries with PostGIS in Ionic Angular

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2023-03-01, 20 min read, How-to. Original: [https://supabase.com/blog/geo-queries-with-postgis-in-ionic-angular](https://supabase.com/blog/geo-queries-with-postgis-in-ionic-angular)

## Summary

PostGIS on Supabase handles geo data for an Ionic Angular app with a Capacitor Google Map. A stores table holds geography(POINT) locations behind a GIST spatial index. Two SQL functions do the geo queries: nearby\_stores orders stores by the \<-\> distance operator and returns st\_distance in meters, and stores\_in\_view filters with && against an ST\_MakeBox2D bounding box. The app calls them via Supabase RPC, inserts locations as WKT POINT(long lat) strings, uploads store images to Supabase Storage, and covers the native location permissions and API keys needed for iOS and Android.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Maps & geospatial](https://swe.quest/tags/geospatial.md) (Domains)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- Postgres basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Angular
- Ionic/Capacitor

## Keywords

PostGIS, Supabase, Ionic, Angular, Capacitor, Google Maps, GIST index

## Related posts

- [Postgres Realtime location sharing with MapLibre](https://swe.quest/articles/postgres-realtime-location-sharing-with-maplibre-f6d03ffa8efe5716.md): Supabase · 2024-07-04 · Medium · 5 min read · Real-time systems, Maps & geospatial, PostgreSQL, React, Serverless
  Live location sharing is built by having a Telegram bot running in a Supabase Edge Function (grammY on Deno) capture edited-location updates and write them to Postgres through a PL/pgSQL RPC.
- [Building an Uber Clone with Flutter and Supabase](https://swe.quest/articles/building-an-uber-clone-with-flutter-and-supabase-eaa64bc8188b0796.md): Supabase · 2024-09-05 · Medium · 15 min read · Mobile, PostgreSQL, Maps & geospatial, Real-time systems
  An Uber-style consumer ride app can be built with Flutter on top of Supabase, using PostGIS geography columns to store driver locations and Supabase Realtime to stream the driver's position onto a Google Map.
- [Generate Vector Tiles with PostGIS](https://swe.quest/articles/generate-vector-tiles-with-postgis-b14acc8d0f59fc3b.md): Supabase · 2024-06-26 · Medium · 6 min read · Maps & geospatial, PostgreSQL, Frontend
  PostGIS can generate Mapbox Vector Tiles on demand from Postgres rows, so a MapLibre GL client can render large point datasets while transferring only the data for the current viewport and zoom level.
- [Maps with PostgreSQL and PostGIS](https://swe.quest/articles/maps-with-postgresql-and-postgis-b8b01c8d5b51a400.md): Zalando Engineering · 2021-12-01 · Medium · 7 min read · Maps & geospatial, PostgreSQL, Kubernetes, Frontend
  PostGIS can generate Mapbox vector tiles directly, so a browser map needs only PostgreSQL/PostGIS, a thin tile server (pg\_tileserv) and a Leaflet frontend, with no heavy tiling middleware.
- [Roll Your Own Analytics With Astro, Vercel Edge Functions and Neon](https://swe.quest/articles/roll-your-own-analytics-with-astro-vercel-edge-functions-and-neon-0f9127dd2d84817b.md): Neon · 2023-10-03 · Medium · 8 min read · Analytics & OLAP, Serverless, PostgreSQL, JavaScript, Frontend
  A self-hosted page-view analytics pipeline replaces Google Analytics after GA4 dropped the latitude/longitude reporting dimension.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
