pg_sphere
spherical objects with useful functions, operators and index support
pgsphere : spherical objects with useful functions, operators and index support
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3650 | pg_sphere | pgsphere | 1.5.2 |
TYPE | BSD-3-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | q3c postgis earthdistance pointcloud h3 pgrouting mobilitydb ogr_fdw pg_geohash qdgc |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 1.5.2 |
18 17 16 15 14 | pgsphere |
- |
| RPM | PIGSTY | 1.5.2 |
18 17 16 15 14 | pgsphere_$v |
- |
| DEB | PGDG | 1.5.2 |
18 17 16 15 14 | postgresql-$v-pgsphere |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| el8.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| el9.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| el9.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| el10.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| el10.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
| d12.x86_64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| d12.aarch64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| d13.x86_64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| d13.aarch64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u22.x86_64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u22.aarch64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u24.x86_64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u24.aarch64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u26.x86_64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
| u26.aarch64 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 | PGDG 1.5.2 |
Source
github.com/postgrespro/pgsphere
pgsphere-1.5.2.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
pg_sphere: spherical geometry data types and operations for PostgreSQL
The pg_sphere extension provides spherical geometry types and operations, useful for astronomy, geospatial, and other applications involving spherical coordinates.
Data Types
- Spherical point (
spoint): A location on a sphere (longitude, latitude in radians) - Spherical circle (
scircle): A circular region defined by center and radius - Spherical line (
sline): A great circle segment - Spherical ellipse (
sellipse): An elliptical region on a sphere - Spherical polygon (
spoly): A multi-vertex shape on a sphere - Spherical path (
spath): A connected sequence of points - Spherical box (
sbox): A bounding box on a sphere
Core Operations
- Membership testing (point in polygon, point in circle, etc.)
- Overlap detection between spherical objects
- Circumference and area calculations
- Object rotation using Euler angles for coordinate transformations
- Distance calculations between spherical objects
Index Support
- GiST index: R-tree implementation for efficient spatial queries
- BRIN index: Block range indexing for large datasets
Input/Output
The extension handles input and output in various coordinate formats commonly used in astronomy and geospatial applications, including degrees, radians, and HMS/DMS notation.