Re: Data type to store latitude and longitude

From: woodb(at)niwa(dot)co(dot)nz
To: <gandalf_mp(at)yahoo(dot)com(dot)br>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Data type to store latitude and longitude
Date: 2005-07-13 22:05:56
Message-ID: 59731.192.168.57.128.1121292356.squirrel@secure.niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Hi guys,
>
> Is there a data type to store data extracted from a
> GPS? The only thing I need is store latitude and
> longitude.
>
> Thanks in advance,
>

There are a few options,

Using basic Postgresql:
store the lats as +-90 & longs as 0-360 or +-180 numeric datatypes.
create a numeric array attribute with two values much as above
use the native Postgres point datatype (largely unsupported and I don't
know if it still exists in current versions)

Or as Tom suggested, use PostGIS to add OGC compliant geometric datatypes
including points, lines and polygons, an effective spatial index, as well
as a good set of spatial functions/operators to Postgresql.

I'd recomend the latter, also adding something like QGIS to add an Open
Source GIS (Geographic Information System) package which allows you to
plot and query PostGGIS tables as layers/themes in a desktop GIS.

Both should be OK in Linuz/Windows/Mac environments.... I've only used
them with Linux.

I have used PostGIS/QGIS with a system where a Perl script parsed &
inserted NMEA GPS data into a PostGIS table, if you are downloading data
as Garmin/Magellan or whatever exports, then you might find gpsbabel
useful.

Cheers,

Brent Wood

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Morgan Lloyd 2005-07-13 22:17:41 Re: Nulls in timestamps
Previous Message Alvaro Herrera 2005-07-13 22:04:39 Re: index bloat