[postgis-users] AsSvg bug fixes
Olivier Courtin
pnine at free.fr
Mon Oct 25 06:46:45 PDT 2004
Hi,
Some little fixes for AsSvg function (from postgis cvs) :
1) Y axe in SVG is reverse (i.e 0,0 point in upper left)
2) Relative path correction in print_svg_path_rel
--- lwgeom_svg.c 2004-10-15 13:48:48.000000000 +0200
+++ patched_lwgeom_svg.c 2004-10-25 15:37:47.000000000 +0200
@@ -192,7 +192,7 @@
sprintf(x, "%.*f", precision, pt->x);
trim_trailing_zeros(x);
- sprintf(y, "%.*f", precision, pt->y);
+ sprintf(y, "%.*f", precision, pt->y * -1);
trim_trailing_zeros(y);
sprintf(temp, "x=\"%s\" y=\"%s\"", x, y);
@@ -211,7 +211,7 @@
sprintf(x, "%.*f", precision, pt->x);
trim_trailing_zeros(x);
- sprintf(y, "%.*f", precision, pt->y);
+ sprintf(y, "%.*f", precision, pt->y * -1);
trim_trailing_zeros(y);
sprintf(temp, "cx=\"%s\" cy=\"%s\"", x, y);
@@ -238,7 +238,7 @@
}
sprintf(x, "%.*f", precision, pt->x);
trim_trailing_zeros(x);
- sprintf(y, "%.*f", precision, pt->y);
+ sprintf(y, "%.*f", precision, pt->y * -1);
trim_trailing_zeros(y);
result+= sprintf(result,"%s %s", x, y);
}
@@ -259,7 +259,7 @@
sprintf(x, "%.*f", precision, pt->x);
trim_trailing_zeros(x);
- sprintf(y, "%.*f", precision, pt->y);
+ sprintf(y, "%.*f", precision, pt->y * -1);
trim_trailing_zeros(y);
result += sprintf(result,"%s %s l", x, y);
@@ -268,9 +268,9 @@
for (u=1; u<pa->npoints; u++)
{
pt = (POINT2D *)getPoint(pa, u);
- sprintf(x, "%.*f", precision, pt->x);
+ sprintf(x, "%.*f", precision, pt->x - lpt->x);
trim_trailing_zeros(x);
- sprintf(y, "%.*f", precision, pt->y);
+ sprintf(y, "%.*f", precision, (pt->y - lpt->y) * -1);
trim_trailing_zeros(y);
result+= sprintf(result," %s %s", x, y);
lpt = pt;
HTH :)
--
Ol
More information about the postgis-users
mailing list