From 0c9602e9f33043ee908d1e3759f3be2b882f0a16 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 25 May 2016 21:28:05 -0500 Subject: [PATCH] Add Assumed Radius Of The Earth as a postgres til --- README.md | 3 ++- postgres/assumed-radius-of-the-earch.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 postgres/assumed-radius-of-the-earch.md diff --git a/README.md b/README.md index 42b18b8..06b14b3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_422 TILs and counting..._ +_423 TILs and counting..._ --- @@ -174,6 +174,7 @@ _422 TILs and counting..._ - [Add ON DELETE CASCADE To Foreign Key Constraint](postgres/add-on-delete-cascade-to-foreign-key-constraint.md) - [Adding Composite Uniqueness Constraints](postgres/adding-composite-uniqueness-constraints.md) - [Aggregate A Column Into An Array](postgres/aggregate-a-column-into-an-array.md) +- [Assumed Radius Of The Earth](postgres/assumed-radius-of-the-earth.md) - [Auto Expanded Display](postgres/auto-expanded-display.md) - [Change The Current Directory For psql](postgres/change-the-current-directory-for-psql.md) - [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md) diff --git a/postgres/assumed-radius-of-the-earch.md b/postgres/assumed-radius-of-the-earch.md new file mode 100644 index 0000000..9caec93 --- /dev/null +++ b/postgres/assumed-radius-of-the-earch.md @@ -0,0 +1,18 @@ +# Assumed Radius Of The Earth + +Using the +[`earthdistance`](https://www.postgresql.org/docs/8.3/static/earthdistance.html) +module, we can get the assumed radius of the earth (in meters). + +```sql +> create extension cube; +CREATE EXTENSION + +> create extension earthdistance; +CREATE EXTENSION + +> select earth(); + earth +--------- + 6378168 +```