XML technologies / SVG / The coordinate system of SVG graphics / What is the coordinate system?

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

Every graphics format needs an unambiguous coordinate system to position elements precisely. Its origin is usually the graphic’s upper-left corner.

The SVG standard defines it as follows:

“The SVG canvas defines the space in which SVG contents are rendered. It is infinite in every direction, but rendering takes place relative to a bounded rectangular area within it, called the viewport.
The viewport’s size is negotiated between the SVG document and its parent document. The viewer or browser then supplies two integers giving its width and height in pixels, plus a decimal value giving a pixel’s physical size, such as millimeters.” (Note: translated from the German text’s translation of the original English W3C documentation.)

Note:
The original documentation uses the terms canvas and viewport. The latter is the visible area; the canvas is the drawing surface. A user agent is software interpreting SVG code as graphics, currently SVG Viewer, perhaps later a browser or another plug-in. The English and translated terms are used interchangeably below to help when consulting the original documentation.

This definition needs clarification. The last chapter explained embedding an SVG graphic into HTML, setting its displayed size with the HTML tag’s attributes height and width. A 500 x 300 pixel graphic can thus appear in 50 x 30 pixels. The HTML attributes width and height define the visible area, the viewport. The width and height attributes of the <svg> tag inside the SVG file instead define the drawing surface’s size.

This still does not fully explain the coordinate system, because SVG offers more than one.

   

   

 

 

 

back to top