Early work on the map SVG and JSON
Posted by mholmes on 28 Nov 2014 in Activity log
I'm writing the XQuery that generates JSON info for OpenLayers. I've discovered a number of things about the SVG that we should be aware of:
- We definitely want the plain SVG output.
- Paths in the @d attribute begin with m (move to) and if they end with z, it means they're closed paths; otherwise they're open.
- Single points are difficult to represent. If you choose the pencil and Control+left click in Inkscape, you get a point, but it's actually a move-to followed by an elliptic arc (a) command, then its parameters. We can simply get the move-to and deduce from the "a" that we have a point, then represent it as a point feature.
- The coordinates in @d are relative to the first move-to point, so to expand them, I have to calculate each point based on the last one. Also, the y coords have to be minused for OpenLayers.