[postgis-devel] GeomRound and GeomTrunc functions
gino-postgisdevel at lucrezi.net
Fri Jul 2 03:09:48 PDT 2004
> - Since the inspiration come from ROUND and TRUNC
> what about using ROUND and TRUNC instead of
> GEOM_ROUND and GEOM_TRUNC for function names ?
geom_round is the 'internal' C name, the name a PostGIS user sees is GeomRound.
Indeed, I could have called them this way, PostgreSQL overloading allows it.
> - Insipiring functions work on 1-dimensional types
> what about making Geometry functions take in
> consideration 2 and 3 dimensions ? Do you see
> any use of rounding with different values the 3
> dimensions ?
I didn't think of it. It could be useful in some cases, especially for the Z axis.
Anyway, it started as something I needed, but it can be improved. Maybe, if you just specify 1 number of digits it will apply to all, if you specify 3 they will be used for x, y and z respectively.
> - 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.
> - How would rounding simplify display of geoms ?
I frequently inspect the geometries as psql will report them.
Removing needless digits saves space on my monitor and paper when I print them.
When I display them on a map there is no change, obviously. Maybe I should have used a different verb than "display" :-)
Penta Consulting Services Srl
More information about the postgis-devel