convert
conversion functions for spatial, routing and other specialized uses
Repository
rustprooflabs/convert
https://github.com/rustprooflabs/convert
Source
convert-0.1.0.tar.gz
convert-0.1.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_convert | 0.1.0 | FUNC | MIT | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4850 | convert | No | Yes | No | Yes | Yes | No | - |
| Related | unit |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 1817161514 | pg_convert | - |
| RPM | PIGSTY | 0.1.0 | 1817161514 | pg_convert_$v | - |
| DEB | PIGSTY | 0.1.0 | 1817161514 | postgresql-$v-convert | - |
Build
You can build the RPM / DEB packages for pg_convert using pig build:
pig build pkg pg_convert # build RPM / DEB packages
Install
You can install pg_convert directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pg_convert; # Install for current active PG version
pig ext install -y pg_convert -v 18 # PG 18
pig ext install -y pg_convert -v 17 # PG 17
pig ext install -y pg_convert -v 16 # PG 16
pig ext install -y pg_convert -v 15 # PG 15
pig ext install -y pg_convert -v 14 # PG 14
dnf install -y pg_convert_18 # PG 18
dnf install -y pg_convert_17 # PG 17
dnf install -y pg_convert_16 # PG 16
dnf install -y pg_convert_15 # PG 15
dnf install -y pg_convert_14 # PG 14
apt install -y postgresql-18-convert # PG 18
apt install -y postgresql-17-convert # PG 17
apt install -y postgresql-16-convert # PG 16
apt install -y postgresql-15-convert # PG 15
apt install -y postgresql-14-convert # PG 14
Create Extension:
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.59
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.