[postgis-devel] GeomRound and GeomTrunc functions
gino-postgisdevel at lucrezi.net
Fri Jul 2 05:16:01 PDT 2004
> > > - Doesn't SQL provide casting toward numeric data ?
> > > Have you tried defining your funx as taking int2 and
> > > see if postgresql will convert numeric values to int2 ?
> > I tried, and it didn't do it automatically.
> > If it is defined as FUNCTION GeomRound(geometry, int2) then I
> > have to call it as GeomRound( the_geom, 1::int2 ) which isn't nice.
> Maybe if you define the function as taking numeric instead of int2
> you'll get all casts for free (I don't think you'll loose much performance)
I think so, but as I said this was my first effort.
I wanted to use the smallest possible data type (an habit of mine), and I didn't know yet of possible pitfalls in doing so.
As for performance, I don't think an extra two bytes might have any impact; the use of a wrapper function (as I did now) has some impact, on the other hand.
> Oh, ok. You have no use for x/y/z differentiation then.
I don't, but someone else might.
In some cases, accuracy on the x axis might be different from that on the y axis, especially if coordinate transforms have been used.
Accuracy on the z axis (if used) is almost always different.
> What I've implemented is a generic grid application function.
It's quite interesting.
I'm studying its code.
Penta Consulting Services Srl
More information about the postgis-devel