The last part on maps, I promise ... its been a fun ride for me at least :0) If you need to catch up on previous episodes:
In this post we're looking at map quality. On the left a JPG map, to the right an SVG output.
If we ignore the fact that they have different levels of features or layers. Imagine getting the maps into a PDF and then printing them. Its pretty clear that the SVG version of the map is going to render better on paper compared to JPG.
Getting the SVG output from mapviewer is pretty straightforward, getting BIP to render it requires a little bit of effort. I have mentioned the XML request that we construct and then do a variable substitution in our servlet. All we need do is add another option to the requested output. Mapviewer supports several flavors of SVG:
- If you specify SVG_STREAM, the stream of the image in SVG Basic (SVGB) format is returned directly;
- If you specify SVG_URL, a URL to an SVG Basic image stored on the MapViewer host system is returned.
- If you specify SVGZ_STREAM, the stream of the image in SVG Compressed (SVGZ) format is returned directly;
- If you specify SVGZ_URL, a URL to an SVG Compressed image stored on the MapViewer host system is returned. SVG Compressed format can effectively reduce the size of the SVG map by 40 to 70 percent compared with SVG Basic format, thus providing better performance.
- If you specify SVGTINY_STREAM, the stream of the image in SVG Tiny (SVGT) format is returned directly;
- If you specify SVGTINY_URL, a URL to an SVG Tiny image stored on the MapViewer host system is returned. (The SVG Tiny format is designed for devices with limited display capabilities, such as cell phones.)
Dont panic, Ive looked at them all for you and we need to use SVGTINY_STREAM. This sends back a complete XML file representation of the map in SVG format. We have a couple of issues:
- We need to strip the XML declaration from the top of the file: <?xml version="1.0" encoding="utf-8"?> If we don't BIP will choke on the SVG. Being lazy I just used a string function to strip the line out in my servlet:
- We need to handle the SVG when it comes back to the template. We do not use the