7 Serverless Spatial APIs • Aurora PostgreSQL Serverless v2

Serverless PostGIS, 3D & Raster Lambda Microservices

Tech Maven Geospatial deploys a complete suite of seven injection-safe AWS Lambda microservices (`postgis_ops/`) that turn Aurora PostgreSQL Serverless v2 + PostGIS into an on-demand 2D, 3D, statistical, and raster geoprocessing API. Using the connectionless RDS Data API over HTTPS, your database scales to 0.0 ACU when idle and wakes automatically on the first request.

23+ 2D Ops
Buffer, clip, dissolve, intersect, union, voronoi, simplify, concave hull & more
7 3D Ops
3D proximity, 3D intersections, LOD1 extrusion, 3D corridors & volumetrics
4 Raster Ops
Zonal stats, point elevation sampling, 3D DEM draping & raster metadata
Zero VPC NAT
RDS Data API runs over AWS HTTPS endpoints without VPC NAT Gateways or proxies
Interactive API Inspector

Live PostGIS Microservice Payload Explorer

Click any of the 7 microservices below to inspect its supported operations, execution mode, and JSON invocation payload.

23 Vector Spatial Operations

FastGeospatial (`geospatial`)

Executes classic 2D PostGIS vector geoprocessing operations with validated identifiers and parameterized values. Supports returning GeoJSON FeatureCollections directly or materializing results into `workspace.` with an automatic GIST spatial index.

Supported Operations

address, area, bbox, bbox_grid, buffer, centroid, clip, collect, concave_hull, convex_hull, difference, dissolve, distance, envelope, extent, hexagonal_grid, intersect, length, line_merge, nearest, point_on_surface, polygonize, simplify, smooth, split, square_grid, sym_difference, transform, triangulate, union, validate, voronoi, within

Example Request Payload (`POST /` or `aws lambda invoke`)
{
  "service": "geospatial",
  "operation": "buffer",
  "table": "public.parcels",
  "distance": 250,
  "units": "meters",
  "dissolve": false,
  "output_table": "parcels_buffered_250m",
  "limit": 500
}
Complete Microservice Catalog

Deep Dive: All 7 Serverless PostGIS Lambda Microservices

Deployable individually per microservice (`FastGeospatialFunction`, `FastGeo3DFunction`, etc.) or through a single unified router (`PostgisUnifiedFunction`).

1. FastGeospatial (`postgis_ops/geospatial.py`)

2D Vector Geoprocessing & Spatial Grids

Replicates and hardens the `FastGeospatial` microservice pattern with strict identifier validation and bound SQL parameters.

  • Overlay & Proximity: `buffer` (with metric unit conversion via ` geography`), `clip`, `intersect`, `difference`, `sym_difference`, `union`, `dissolve`, `nearest`, and `within`.
  • Tessellation & Geometry Generation: `hexagonal_grid` (`ST_HexagonGrid`), `square_grid` (`ST_SquareGrid`), `voronoi` (`ST_VoronoiPolygons`), `triangulate` (`ST_DelaunayTriangles`), `convex_hull`, and `concave_hull`.
  • Geometry Refinement & Metrics: `simplify` (`ST_SimplifyPreserveTopology`), `smooth` (`ST_ChaikinSmoothing`), `validate` (`ST_MakeValid`), `area`, `length`, `centroid`, `point_on_surface`, and `transform`.
2. FastGeo3D (`postgis_ops/spatial3d.py`)

3D Proximity, Extrusion, Corridors & Volumetrics

Built specifically for managed AWS RDS and Aurora PostgreSQL using core PostGIS 3D functions and `POLYHEDRALSURFACE Z` geometry synthesis (no `postgis_sfcgal` C-extension required).

  • 3D Proximity & Clearance: `proximity_3d` (`ST_3DDWithin`, `ST_3DDistance`, `ST_3DShortestLine`, `ST_3DLongestLine`) and `intersects_3d` (`ST_3DIntersects` + 3D bounding box `&&&`).
  • LOD1 3D Extrusion (`extrude_3d`): Extrudes 2D polygon footprints into closed 3D `POLYHEDRALSURFACE Z` solids using roof and base height attributes or constants via `app.extrude_polygon_3d()`.
  • 3D Airspace & Utility Corridors (`slice_volume_3d`): Buffers 3D trajectories (`LINESTRING Z`) and filters intersecting 3D structures within a `[z_min, z_max]` elevation band.
  • Volumetric Massing (`volumetrics_3d` & `bbox_3d`): Computes 2D footprint area, vertical relief (`ST_ZMax - ST_ZMin`), 3D surface area, and prismatic volume (`m³`).
3. FastGeoRaster (`postgis_ops/georaster.py`)

In-Database DEM Terrain Draping & Zonal Analytics

Harnesses the managed `postgis_raster` extension on Aurora PostgreSQL Serverless v2 to combine vector features with tiled elevation and environmental rasters.

  • Zonal Statistics (`zonal_stats`): Clips tiled rasters (`ST_Clip(r.rast, v.geom)`) and aggregates `count`, `sum`, `mean`, `stddev`, `min`, and `max` via `ST_SummaryStatsAgg`.
  • Point Sampling (`sample_points`): Extracts exact raster cell values (`ST_Value`) at point locations or polygon centroids.
  • 3D Terrain Draping (`drape_3d`): Samples DEM elevation tiles at every vertex of a 2D geometry (`ST_DumpPoints` + `ST_SetZ`) to construct true 3D `PointZ`, `LineStringZ`, or `PolygonZ` features.
  • Raster Metadata (`raster_metadata`): Returns pixel scale, SRID, band count, nodata values, and tile grid alignment.
4. FastGeostats (`postgis_ops/geostats.py`)

Choropleth Classification & Spatial Autocorrelation

Computes statistical distributions, class breaks, and spatial autocorrelation directly inside PostgreSQL so web clients never need to download full attribute tables.

  • 14 Statistical Operations: `equal_interval`, `quantile`, `jenks` (Fisher-Jenks natural breaks approximation), `standard_deviation`, `geometric_progression`, `head_tail` breaks.
  • Summary & Distribution: `summary` (min, max, mean, median, stddev, skewness, kurtosis, IQR), `histogram`, `boxplot`, `z_score`, and `unique_values`.
  • Multivariate & Spatial Weights: `correlation` (Pearson `corr(a, b)` + covariance) and `moran` (Global Moran's I spatial autocorrelation using distance-band neighbor weights).
5. FastGeosuitability (`postgis_ops/geosuitability.py`)

Multi-Criteria Decision Analysis (MCDA) & Site Selection

Evaluates candidate parcels, hex grids, or regions against weighted spatial and numeric criteria with automated normalization.

  • Weighted Criteria Scoring (`score`): Normalizes any combination of columns using `min_max` (`0..1`), `z_score`, or `boolean_threshold`, applies positive or inverse polarity, and calculates a 0–100 `suitability_index`.
  • Spatial Proximity Factors: Incorporates distance-to-target-table (`ST_Distance(a.geom::geography, b.geom::geography)`) directly into the weighted score.
  • Hard Exclusion Masks (`boolean_mask`): Applies strict regulatory or environmental exclusion filters alongside ranked scoring.
6. FastGeoTable & 7. FastImporter

Guardrailed Schema Management & S3/HTTP Vector Ingestion

Manage workspace tables and ingest external vector datasets without direct database superuser access.

  • FastGeoTable (`geotable.py`): `list_tables`, `describe_table`, `preview`, `count`, `spatial_index` (2D `GIST` or 3D `gist_geometry_ops_nd`), plus schema-locked (`workspace`/`scratch`) `add_column`, `update_column`, `rename_column`, `drop_column`, and `drop_table`.
  • FastImporter (`importer.py`): Loads GeoJSON (`FeatureCollection`), CSV (lat/lon or WKT), or JSON arrays from `s3://` (locked to `ALLOWED_S3_BUCKETS`) or HTTPS URLs with batched `ST_SetSRID(ST_GeomFromGeoJSON(...), srid)` inserts and automatic spatial indexing.
  • Table Materialization (`output_table`): Any `geospatial`, `spatial3d`, `georaster`, or `geosuitability` call can persist its output directly into `workspace.` with an automatic spatial index.
Database Connectivity & Security

Dual-Driver Execution & Five-Layer SQL Security Guardrails

Designed for zero-trust cloud environments and seamless AI agent tool invocation.

1. RDS Data API Mode (`rds_data`)

Communicates with Aurora PostgreSQL Serverless v2 over AWS's internal HTTPS endpoint using `boto3.client('rds-data')` and IAM + Secrets Manager authentication. Requires no VPC attachment, no NAT Gateways, and no RDS Proxy, while seamlessly handling Aurora scale-from-zero wakeups.

2. Direct Libpq Mode (`psycopg`)

For high-throughput VPC deployments or containerized workers, set `DB_DRIVER=psycopg` to switch the exact same microservice handlers to pooled `psycopg` v3 connections with zero code changes.

3. Strict Identifier & Schema Guards

All schema, table, and column names pass regex validation (`^[a-zA-Z_][a-zA-Z0-9_]{0,62}$`) and double-quoting (`quote_ident`). DDL and `output_table` writes are strictly confined to `workspace` and `scratch` schemas (`DEFAULT_WRITE_SCHEMAS`).

Combine Sub-Second PostGIS APIs with Massive-Scale Batch Processing

See how Tech Maven Geospatial complements Aurora PostGIS microservices with serverless AWS Batch on Fargate, DuckDB 2.0, Rust Terrio, and Apache Sedona.