Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Geometry vs. Geography


Great, that was easy! Now, we will show you how to convert a geometry column to a geography column to increase the accuracy of the representation. In PostGIS, all you have to do is append ::geography to the name of the column. Take a look at the following example:

FROM sf_hotels 
WHERE id = 1;

The query above will first convert the boundaries column into a geography column, and will then calculate the area of the polygon it refers to.

Note that we can use ST_Area (and a bunch of other functions) with both geometry and geography columns. However, it seems we didn't have to specify the SRID of the boundaries column. It turns out that an SRID is only necessary for geometry columns, as it describes the 2D projection that should be used.

Geography columns don't require any projections. By default, they return results in meters or square meters.


Add a second column to the given template and calculate the length of the route using the geography column type.

Compare the results. As you can see, they are very similar.

Stuck? Here's a hint!

Use ST_Length(course::geography).