[postgis-users] AsSVG() and precision control

Klaus Foerster klaus.foerster at uibk.ac.at
Thu Oct 14 01:06:23 PDT 2004


the current version of AsSVG() allows specification of the number of significant digits as
second argument. this is meaningful on a single value, but looses meaning when coordinates
are taken into group (e.g. different number of digits in x, y coordinates or relative
path-notation). i've written a patch for postgis_svg.c that uses the following approach:

  if you omit the second argument, values are preserved as they are and formatted as %.*g,
  if you use a second argument, values are formatted with desired precision using ".*f"

you can find a patch at http://svg.cc/pg/assvg/assvg-0.5.patch along with a test-page,
showing sample queries and their results at http://svg.cc/pg/assvg/1_output.txt

having something like apply_grid() in postgis (1.0?) would make this solution obsolete, but
as long as it's not there, i think we should provide a way to specify precision within AsSVG().
any other thoughts on that subject from the rest of the group?

klaus

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



More information about the postgis-users mailing list