pg_sphere
spherical objects with useful functions, operators and index support
Repository
postgrespro/pgsphere
https://github.com/postgrespro/pgsphere
Source
pgsphere-1.5.2.tar.gz
pgsphere-1.5.2.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pgsphere | 1.5.2 | TYPE | BSD-3-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3650 | pg_sphere | No | Yes | No | Yes | No | Yes | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 1.5.2 | 1817161514 | pgsphere | - |
| RPM | PIGSTY | 1.5.2 | 1817161514 | pgsphere_$v | - |
| DEB | PGDG | 1.5.2 | 1817161514 | postgresql-$v-pgsphere | - |
Build
You can build the RPM packages for pgsphere using pig build:
Install
You can install pgsphere directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
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.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)