[postgis-users] AsSVG() and precision control

Klaus Foerster klaus.foerster at uibk.ac.at
Thu Oct 14 03:26:44 PDT 2004


> Your patch does not do what reported:
> Precision defaults to 15, so you need to give it an explicit negative
> number for the %g to take effect. Default would be 0 padded numbers.
sorry, forgot about that - http://svg.cc/pg/assvg/assvg-0.5.1.patch solves
that issue by setting default precision to -1 and using %.15g or %.*f
accordingly.

> What I see is that the problem only arises for relative moves, where
> number of significant digits wants to be different between absolute
> and relative values.
well, absolute notation might be affected as well. what about a coordinate
pair like 241034.194490223,5610355.30134846 ? if you reduce output to seven
digits you start mixing coordinate precision as x-coordinates originally have 6,
and y-coords 7 digits to the left - 241034.2 -5610355 would be the result.

> A proposal I can make is that:
> 
> 	- On "absolute" are requested all values will have 'precision'
> 	  number of significant digits
> 
> 	- On "relative" way initial (absolute) values will have 15
> 	  significant digits, and relative values will have 'precision'
> 	  number of significant digits.
> 
> Do you think this would solve the problem ?
i think absolute and relative notation should be treated the same way. please give
my latest patch a try - i do think it now does what i intended to accomplish ;-)
i've also updated http://svg.cc/pg/assvg/1_output.txt to reflect the change.

klaus

-- 
          O-.
          /_ )
           | (U
klaus*   /|
         / /
         ~ ~




More information about the postgis-users mailing list