convert
convert
pg_convert : conversion functions for spatial, routing and other specialized uses
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4850 | convert | pg_convert | 0.1.0 | FUNC | MIT | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | convert |
| See Also | unit |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 18 17 16 15 14 | pg_convert | - |
| RPM | PIGSTY | 0.1.0 | 18 17 16 15 14 | pg_convert_$v | - |
| DEB | PIGSTY | 0.1.0 | 18 17 16 15 14 | postgresql-$v-convert | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
el8.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
el9.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
el9.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
el10.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
el10.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
d12.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
d12.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
d13.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
d13.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
u22.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
u22.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
u24.x86_64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
u24.aarch64 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 | PIGSTY 0.1.0 |
Source
pig build pkg pg_convert; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_convert; # install via package name, for the active PG version
pig install convert; # install by extension name, for the current active PG version
pig install convert -v 18; # install for PG 18
pig install convert -v 17; # install for PG 17
pig install convert -v 16; # install for PG 16
pig install convert -v 15; # install for PG 15
pig install convert -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION convert;Usage
Provides functions for common unit conversions: distance, speed, time-to-travel, power, area, and temperature.
CREATE EXTENSION convert;Distance Functions
| Function | Description |
|---|---|
dist_mi_to_ft(miles) | Miles to feet |
dist_ft_to_mi(feet) | Feet to miles |
dist_ft_to_m(feet) | Feet to meters |
dist_m_to_ft(meters) | Meters to feet |
dist_m_to_km(meters) | Meters to kilometers |
dist_km_to_m(km) | Kilometers to meters |
dist_mi_to_km(miles) | Miles to kilometers |
dist_m_to_mi(meters) | Meters to miles |
dist_km_to_mi(km) | Kilometers to miles |
Speed Functions
| Function | Description |
|---|---|
speed_mph_to_kmhr(mph) | MPH to km/h |
speed_kmhr_to_mph(kmhr) | km/h to MPH |
speed_kmhr_to_m_s(kmhr) | km/h to m/s |
speed_mph_to_m_s(mph) | MPH to m/s |
speed_m_s_to_kmhr(m_s) | m/s to km/h |
speed_m_s_to_mph(m_s) | m/s to MPH |
Area Functions
| Function | Description |
|---|---|
area_m2_to_km2(m2) | sq meters to sq km |
area_m2_to_ft2(m2) | sq meters to sq feet |
area_ft2_to_m2(ft2) | sq feet to sq meters |
area_ft2_to_mi2(ft2) | sq feet to sq miles |
area_mi2_to_ft2(mi2) | sq miles to sq feet |
area_mi2_to_acre(mi2) | sq miles to acres |
area_acre_to_mi2(acres) | Acres to sq miles |
area_acre_to_km2(acres) | Acres to sq km |
Temperature Functions
| Function | Description |
|---|---|
temp_c_to_f(celsius) | Celsius to Fahrenheit |
temp_f_to_c(fahrenheit) | Fahrenheit to Celsius |
Power Functions
| Function | Description |
|---|---|
power_dbm_to_watts(dbm) | dBm to watts |
power_watts_to_dbm(watts) | Watts to dBm |
Examples
SELECT dist_mi_to_km(26.2); -- 42.16 (marathon in km)
SELECT temp_f_to_c(98.6); -- 37.0
SELECT speed_mph_to_kmhr(60.0); -- 96.56
SELECT area_acre_to_km2(640.0); -- ~2.59Last updated on