Supported Spatial Operations
GeoETL provides 39 PostGIS-compatible spatial SQL functions powered by the GEOS library. These functions enable geometry manipulation, spatial analysis, and data transformation within your SQL queries.
Quick Reference
| Category | Functions | Description |
|---|---|---|
| Construction | 4 | Create geometries from various input formats |
| Measurement | 3 | Measure distance, area, and length |
| Predicate | 10 | Test spatial relationships |
| Validator | 5 | Validate geometry properties |
| Generator | 8 | Generate new geometries |
| Set Operations | 4 | Combine geometries using set theory |
| Accessor | 6 | Extract geometry properties |
All Functions
Construction Functions
| Function | Description |
|---|---|
| ST_GeomFromText | Parse WKT string to geometry |
| ST_GeomFromWKB | Validate WKB binary data |
| ST_Point | Create point from X, Y coordinates |
| ST_MakePoint | Alias for ST_Point |
Measurement Functions
| Function | Description |
|---|---|
| ST_Distance | Calculate minimum distance between geometries |
| ST_Area | Calculate area of a geometry |
| ST_Length | Calculate length/perimeter of a geometry |
Predicate Functions
| Function | Description |
|---|---|
| ST_Intersects | Test if two geometries intersect |
| ST_Contains | Test if geometry A contains geometry B |
| ST_Within | Test if geometry A is within geometry B |
| ST_Overlaps | Test if two geometries overlap |
| ST_Touches | Test if geometries touch at boundaries |
| ST_Crosses | Test if geometries cross each other |
| ST_Disjoint | Test if geometries are disjoint |
| ST_Equals | Test if geometries are spatially equal |
| ST_Covers | Test if geometry A covers geometry B |
| ST_CoveredBy | Test if geometry A is covered by geometry B |
Validator Functions
| Function | Description |
|---|---|
| ST_IsValid | Test if geometry is valid (OGC rules) |
| ST_IsEmpty | Test if geometry is empty |
| ST_IsSimple | Test if geometry is simple |
| ST_IsClosed | Test if geometry is closed |
| ST_IsRing | Test if geometry is a ring |
Generator Functions
| Function | Description |
|---|---|
| ST_Buffer | Create buffer polygon around geometry |
| ST_Centroid | Calculate centroid point |
| ST_Envelope | Compute bounding box |
| ST_ConvexHull | Compute convex hull |
| ST_Boundary | Compute geometry boundary |
| ST_PointOnSurface | Get point guaranteed on surface |
| ST_Simplify | Douglas-Peucker simplification |
| ST_SimplifyPreserveTopology | Topology-preserving simplification |
Set Operation Functions
| Function | Description |
|---|---|
| ST_Union | Combine two geometries |
| ST_Intersection | Intersection of two geometries |
| ST_Difference | Difference of geometries (A - B) |
| ST_SymDifference | Symmetric difference (XOR) |
Accessor Functions
| Function | Description |
|---|---|
| ST_X | Get X coordinate of a Point |
| ST_Y | Get Y coordinate of a Point |
| ST_NumPoints | Count of points in geometry |
| ST_NumGeometries | Count of geometries in collection |
| ST_GeometryType | Get geometry type as string |
| ST_Dimension | Get topological dimension |
Usage Examples
Basic Geometry Creation
SELECT ST_Point(longitude, latitude) as geom FROM locations;
SELECT ST_GeomFromText('POLYGON((0 0, 4 0, 4 4, 0 4, 0 0))') as polygon;
Spatial Analysis
-- Find all buildings within 100 meters of a point
SELECT * FROM buildings
WHERE ST_Distance(geom, ST_Point(-122.4, 37.8)) < 100;
-- Calculate total area by category
SELECT category, SUM(ST_Area(geom)) as total_area
FROM parcels
GROUP BY category;
Geometry Transformation
-- Create 50-meter buffer zones
SELECT id, ST_Buffer(geom, 50) as buffer FROM features;
-- Simplify complex geometries
SELECT id, ST_Simplify(geom, 0.001) as simplified FROM coastlines;
Spatial Filtering
-- Find intersecting features
SELECT a.id, b.id
FROM layer_a a, layer_b b
WHERE ST_Intersects(a.geom, b.geom);
-- Filter by containment
SELECT * FROM points
WHERE ST_Within(geom, (SELECT geom FROM boundaries WHERE name = 'Region A'));
Notes
- All functions use the GEOS library for computational geometry
- Input geometries can be in GeoArrow Point, WKB, or mixed geometry formats
- Output geometries are returned as WKB with
geoarrow.wkbmetadata - NULL inputs return NULL outputs (SQL standard behavior)
- Functions are case-insensitive in SQL queries