SVG 2D Graphics Research
|
|
Home Architecture for 2D Booking Systems Business Charts Engineering Diagrams Engineering Database GIS Logistic Procurement |
GIS
GIS Architecture and IntegrationArchitecture and ApproachWhen you look at it, SVG code can be a bit daunting, but you just need to know what to look for. Our AnalyseSvg program (Windows only) is good at setting out the main structure of any SVG document, and is a great help in clarifying what is going on. You should try it (It's free). Version 1.0.a.1 5 April 2005. Latest Version. It does not do SvgZ files, by the way. Please unzip them first. There are really two distinct ways to use SVG. The first way is the best.
*'Paper' coordinates. That's just a term that we use as a shorthand notion. Computer graphics may be on paper, but they equally may be on a 1280 by 1024 pixel 17"monitor, a 3840 by 2400 pixel 42" projector screen, a 320 by 220 pixel PDA 2" display, or even a 160 by 130 pixel mobile phone screen. The thing is, you have to know beforehand what the output is going to be on: what its resolution and dimensions are. That is critical. You can not simply send VGA output to a mobile phone or vice versa. The amount of text that is right for a large output device is totally different for small one. Likewise on a high-res device you can pack more in than on low-res. To cut through, and make things simple, PenDraw works in terms of defining the size of the surface you are going to output onto, so you can think in terms of real size. Resolution gets better all the time, so resolution is usually less important than physical size. We call it 'paper', because we have found that most people are comfortable with thinking about their drawing as if it is on a piece of paper. It's natural. It's intuitive. It works. Integration – How To Do It
The simplest SVG has an <svg ... > tag to </svg> tag 'block' of SVG code, and inside it are nested <g ... > to </g> tag pairs. If it is structured like that, you simply need the 'outermost' <g ... > to </g> tag pair. (That is how PenDraw creates SVG.) However, it is also possible that there may be several <g ... > to </g> tag pairs between the <svg ... > tag and the </svg> tag. If there are, you need them all. If the GIS constructor has used viewBox unwisely (to our way of thinking), it will look something like this: viewBox="-501067 -14142 12000 9000". That is a sure sign that s/he is using the viewBox to try to stick with real-world coordinates. It is very difficult to work with and to integrate any other graphics. About the only way is to integrate it into Pendraw SVG. You will need to position and scale the GIS SVG <g ... > block: the simplest way would be to put another <g ... > to </g> block around it with the right transform definition in the <g ... > tag. But rather than trying to adapt it, try to persuade them not to do it that way. There are lots of GIS systems/software out there, so if they really can't or won't change, it may be worth getting a different GIS. Can I put them in any order?Whichever SVG code comes later draws 'on top of' the earlier SVG. So if you want to annotate a map with symbols, you want the symbols last in the final SVG file. Plus, don't put a background colour on the drawing that your symbols are on, or that background will be drawn all over the map, with the effect that you won't see the map at all! Problem Cases in IntegrationSome GIS want to hide scale from outsiders. They hide the details of the scales they use and so forth, byt putting them in javascript functions. It is probably well intentioned, to try to react to the size of monitor, or the screen resolution, and so forth. However, it is impossible to integrate their SVG without finding out the basic facts, so you will just have to ask them. Some GIS like to hide SVG code from outsiders (they probably do it to protect their interests so that the SVG can not be copied.) You know you can right-click on SVG and you get a menu that shows "Show Source"? Well, they disable that part of the menu, so you can not see anything of the code at all. Hence you can not analyse it. You will just have to talk to them about it and persuade them to help you.
|