I'm currently trying to draw charts with the help of SQL Anywhere's spatial data support and its SVG output methods. To combine several geometries into one document, I have to use the ST_AsSVG() method with the 'PathDataOnly=Yes' format specifier. Now, when using ST_MultiPoint to draw sets of points, the according ST_AsSVG() method seems to deliver data for a SVG path element. While this works generally, when using a larger scale, the points are not visible as they are rendered by drawing a very narrow square (of 0.002 coordinates length). So typically the method returns data like:
Obviously, the point coordinates are much larger (in my case, between 200 and 10,000) than the square dimensions. When I manually modify the SVG data to use a larger square to draw, say by replacing "l 0.002,0 0,0.002 -0.002,0 Z" with "l 2,0 0,2 -2,0 Z", the points are drawn correctly. Question: Is there a way (e.g. a format specifier) to adapt the square width for the ST_MultiPoint::ST_AsSVG() method? For the moment, I have chosen to use single points instead of multipoints though this enlarged the SVG file significantly. (For the record: Jason's blog article "SQL Graph Paper" was a great starting point - thanks!) asked 21 Jun '11, 05:25 Volker Barth |
When using just path data there is no way to represent a point, thus the small square. The simplest way to combine several geometries into one SVG document is to use: select ST_Geometry::ST_ASSVGAggr( geometry_column ) from geometry_table; If you must use answered 21 Jun '11, 09:14 Ian McHardy Well, as I'm drawing charts, I have to add several text elements (axis description, scale and the like) to the geometrical objects. Adding texts is beyond SQL Anywhere's spatial support, isn't it? Therefore I think I have to build lots of parts of the document manually. REPLACE() would work but the "single point solution" works pretty well (once I had incremented DBISQL's truncation length...). BTW: Wouldn't it be an alternative to return points/multipoints as circle elements instead of pathes?
(21 Jun '11, 09:36)
Volker Barth
Replies hidden
Given that you need to add text elements, I believe you are correct that you need to use I'm not sure what you mean by the "single point solution". Unfortunately, the SVG circle element cannot be used within path data.
(21 Jun '11, 10:39)
Ian McHardy
By "single point solution" I mean that I do not use ST_MultiPoint but add each point on its own in the way ST_Point.ST_AsSVG() with PathDataOnly=No creates point data - it does not create a path element but a rect element, and as such the minimal square size doesn't apply. FWIW, I just used the same values as ST_AsSVG() does - here for the point (10 200): <rect width="0.1%" height="0.1%" stroke="black" stroke-width="0.4%" x="10" y="-200"/> (Note: In contrast, ST_Point.ST_AsSVG() with PathDataOnly=Yes does create path element data even for single points, i.e. in the same way as multipoints.)
(21 Jun '11, 11:00)
Volker Barth
And obviously I could use circle elements in a comparable fashion...
(21 Jun '11, 11:02)
Volker Barth
|
Just to add: Increasing the "stroke-width" attribute of the path element does not help.
That being said, I'm fairly new to SVG so any help...