Re: [GENERAL] does GIS DMS data type already exist? - Mailing list pgsql-general

From Gene Selkov, Jr.
Subject Re: [GENERAL] does GIS DMS data type already exist?
Date
Msg-id 199911140544.XAA14453@antares
Whole thread Raw
In response to Re: [GENERAL] does GIS DMS data type already exist?  (Peter Eisentraut <e99re41@DoCS.UU.SE>)
List pgsql-general
> On Sat, 13 Nov 1999 Peter Eisentraut wrote:
>
> Funny, just today I was thinking "Hmm, a DMS data type might be useful to
> implement."
>
> Right now there is no such thing (in the official sources anyway). Unless
> you want to walk the long path of making up your own datatype (which we'd
> appreciate, of course),

The path is not very long if you just want to solve the problem by
writing an extension in the form of a shared object. You'll have to
write a couple screenfuls of c code, a simple Makefile and a sql
script to craft your data type into the postgres schema. An
entry-level c student with two days of experience can easily do
this. I agree the documentation on extensions is somewhat lean, but I
can guide everyone wishing to write their own types through the entire
process. Contact me directly, we'll do a few iterations, then report
to the list.

However, if you plan on making your type a backend built-in or if you
want to make a configurable and portable extension, you and I could
use some help. I only know how to build shared objects for linux,
freebsd and sun/solaris. Someone's got to know how to add a built-in
type: there were much fewer types at the time when postgres left
Berkeley.

> you might be better off creating a conversion
> function or two in the backend or letting the frontend handle the
> conversion.

doing the conversion in the front end seems like a plausible idea if
you pick an adequate base type to represent your data. I would
advocate using the box type *both* for locations and rectangular areas
in geography -- that will account for efficient indexing and uniform
usage. Same idea if you build your own type -- make it equivalent to
the box type. One can also try and derive the type from the built-in
by writing special i/o and interface functions.

> On second thought, perhaps you could abuse the time datatype. Of course
> it's more like HMS, but perhaps you could make a spin off.

the time datatype is ok as long as your degrees are between zero
and 24. also, you won't be able to do the geometrical indexing on
it. Like I said, do your own, it's going to be fun!

--Gene

> On Sat, 13 Nov 1999 vandewal@dhc.net wrote:
>
> > Hey,
> >
> > I am builing a system that is going to be dealing with a large
> > amount of GIS (geographic) data from USGS.  Some of their data
> > provides lattitude and longitude in the DMS (degrees minnutes seconds)
> > format, other provides lat/lon in decimal format.  The decimal is
> > obviously not a problem for postgres, but the DMS is.  I am going to
> > need to be doing queries based on the DMS data, and will need it
> > treated as numeric instead of just a text string.
> >
> > Soooo (to get to my question already!) what I want to know is
> > whether anyone else has already coded up a data type to do this
> > kind of thing or whether I just have to do it myself.
> >
> > I search around but didn't find one.
> >
> > Thanks for you time.
> >
> > dv
> >
> >
> > // David E. Vandewalle          | The best diplomat I know is a fully
> > // vandewal@skyblue.com         | activated phaser bank.
> > // david.e.vandewalle@lmco.com  |     -- Scotty
> >
> > ************
> >
> >
>
> --
> Peter Eisentraut                  Sernanders vaeg 10:115
> peter_e@gmx.net                   75262 Uppsala
> http://yi.org/peter-e/            Sweden
>
>
> ************
>
>


pgsql-general by date:

Previous
From: "Gene Selkov, Jr."
Date:
Subject: Re: [GENERAL] Problem with C functions ?
Next
From: "j's hyperlinked organisation"
Date:
Subject: Re: PostgreSQL server for Win95 machine