# [postgis] SRID for LAT/LONG

Dave Blasby dblasby at refractions.net
Fri Sep 28 14:58:00 PDT 2001

```> > 3.  Does or will GiST indexes support LAT/LONGs when determining the
> >     bounding box for the GIS object?
>
> I have used lat/long layers and had no problem with indexing.

The problem with using LAT/LONG has to do with the math involved in
making "simple" calculations is really really really difficult.

For example,
In rectangular coordinate system (X,Y), the distance between two points
is a straight line.
In spherical coordinates (lat/long on a sphere), the distance between
two points is a great circle.
In elliptical coordinate (lat/long on an ellipsoid), the distance
between two points is, well, difficult to describe.

PostGIS assumes your locations are in rectangular coordinates (X,Y).
You can run into troubles if you put in lat/long co-ordinates.

For example, there is no sense that POINT(-179.99 0) and POINT(179.99
0) are really close together (on opposite sides of the international
date line).
Also, the bounding box maybe incorrectly calculated.  For example, the
bounding box for LINESTRING(25 25, 40 25) will be BOX3D(25 25 0, 40 25
0) when, in fact, the line connecting those coordinates (on an ellipse)
is probably outside that bounding box.
There's lots of other (mathematical) problems involved in using
elliptical/spherical coordinates.  I recommend that you use a

On the other hand, postgis has no problem storing lat/long/height
information.  There's even a few functions ( length_spheroid(),
length_spheroid3d() ) for doing calculations on an ellipsoid.

Note that OpenGIS [incorrectly] calls ellipsoides "spheroids".

dave
ps. does anyone know of any open source software libraries for doing
calculations on an ellipse?

Get your FREE VeriSign guide to security solutions for your web site: encrypting transactions, securing intranets, and more!
http://us.click.yahoo.com/UnN2wB/m5_CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

```