PostGIS Geospatial Queries

Build location-aware applications with full PostGIS integration. Calculate distances, find nearby points, query polygons, and visualize geographic data — all through simple API parameters.

PostGIS
Powered By
10+
Spatial Functions
Real-time
Location Queries
Any
Coordinate System

Location Intelligence Built In

Modern applications need location awareness. Baasix makes geospatial queries as simple as any other filter.

Store geographic data using Geometry or Geography field types. Then query by distance, find points within polygons, calculate intersections, and sort by proximity — all through the standard REST API. Baasix leverages PostgreSQL's PostGIS extension to provide enterprise-grade spatial capabilities without requiring any GIS expertise.

  • Store points, lines, polygons, and complex geometries in your schema
  • Find nearby records with distance calculations in meters or miles
  • Search within radius, bounding box, or custom polygon
  • Sort results by proximity to a reference point
  • Calculate distances between geographic features
  • Support for multiple coordinate reference systems (SRID)
  • Automatic spatial indexing for fast queries

Geospatial Made Accessible

PostGIS is powerful but complex. Baasix exposes it through a simple API.

✓ With Baasix

  • Add Geometry field type to schema, done
  • Query nearby with simple filter parameter
  • Distance calculations in API response
  • Automatic GIST index creation
  • Works with any mapping frontend

✗ Traditional Approach

  • Install PostGIS, configure extensions manually
  • Write ST_DWithin, ST_Distance queries in raw SQL
  • Build custom endpoints for each spatial operation
  • Create and maintain spatial indexes
  • Parse WKT/GeoJSON in application code

Simple API, Powerful Results

Find nearby stores within 5km, sorted by distance.

GET /api/items/stores
  ?filter[location][dwithin]={"point": [40.7128, -74.0060], "distance": 5000}
  &sort=location:nearest
  &fields=name,address,location,distance

Returns stores within 5km of coordinates (NYC), sorted by distance, with calculated distance in meters included in each result.

Geospatial Capabilities

Distance Queries

Find records within a specified distance from a point. ST_DWithin powered queries with automatic unit conversion.

Proximity Sorting

Sort results by distance from a reference point. Perfect for 'nearest to me' features in mobile apps.

Polygon Queries

Check if points fall within polygons, find intersections, and query overlapping regions. Full spatial relationship support.

Bounding Box Search

Fast spatial queries using rectangular bounds. Ideal for map viewport queries where users pan and zoom.

Geographic Support

Use Geography type for Earth-surface calculations with accurate great-circle distances in meters.

GeoJSON Output

Results include GeoJSON-formatted coordinates ready for mapping libraries like Mapbox, Leaflet, or Google Maps.

Location-Aware Applications

From delivery apps to real estate platforms, geospatial features unlock new possibilities.

Store Locators

Help customers find the nearest store, restaurant, or service location. Show distance, directions, and store details in one query.

RetailFood DeliveryServices

Ride-Sharing & Delivery

Match riders with nearby drivers, optimize delivery routes, and track real-time positions. Distance calculations for fare estimates.

TransportationLogisticsTracking

Real Estate & Property

Search properties within neighborhoods, school districts, or custom boundary polygons. Filter by proximity to amenities.

Real EstateProperty SearchMapping

Fleet Management

Track vehicle positions, define geofences for alerts, and analyze coverage areas. Historical location queries for reporting.

FleetGeofencingIoT

Geospatial FAQ

Do I need to install PostGIS separately?

If you're using a managed PostgreSQL service (Neon, Supabase, RDS), PostGIS is typically available as an extension. Baasix enables it automatically when you add a Geometry field.

What coordinate format should I use?

Baasix accepts coordinates as [longitude, latitude] arrays or GeoJSON Point objects. WGS84 (SRID 4326) is the default and works for global applications.

How do I handle timezone-aware queries?

Geographic queries are coordinate-based and timezone-independent. For time-sensitive location data, store timestamps alongside coordinates and filter by both.

Can I combine geospatial filters with other filters?

Absolutely! Chain geospatial filters with any other filter type. Find open restaurants within 2km that serve Italian food and have 4+ stars.

Ready to build faster?

Join developers who are shipping production-ready backends in hours, not weeks.