At some point on this site I’m bound to start talking about Raster versus Vector formats, so I thought I would preface all of that by writing an article explaining what they are all about. I’ve been surprised at how many people aren’t aware of the difference, and it’s important.
Raster refers to both a raster display, and raster graphics. A raster is also known as as a bitmap, which is an array of data used to define pixel colours, either in a file or on a computer screen. For a screen, the array is in the memory of your graphics card. For a file, it’s stored using a format like JPEG, GIF or PNG.
Raster graphics are defined by their resolution. You’re probably familiar with things like “1024 x 768” or “1280 x 1024”, “HD” — these refer to resolutions. The resolution is the amount of detail in an image, or the number of pixels.
Displaying a raster graphic in its native resolution means drawing the pixels as they are stored in the file, but displaying it in any other resolution means loosing detail. When you draw a graphic smaller than its native resolution you are downsampling it, using some technique of choosing or averaging pixels to decide which ones to draw while still maintaining the fidelity of the original image. When drawing it larger than original you are supersampling the image, which means using various techniques to create new pixels to fill in the area of the image.
Both techniques are attempts to make the image “readable” or at least recognizable as a part of the original. Both techniques have limits. Anyone familiar with the CSI franchise has no doubt seen some incredible TV where the reflection of someone’s face in a shiny surface is enlarged and sharpened. This video pokes fun at this trope, but in reality the level of zoom that is possible is a tiny fraction of what the TV and movie industry shows.
Vector graphics refers to graphics that are made up of geometric primitives such as points, lines, polygons, curves, etc. The combination of these primitives, line thicknesses, colours, fills, and textures can make very sophisticated art. Vector graphics can also refer to the display technology or the graphics format. Some of the earliest computer displays were vector graphics, one popular example being the Asteroids game.
Most modern computer displays are now raster based. However, vector formats are used because they have many advantages. For example, they can be reproduced on any display and at any resolution without loss of clarity, as the example image to the right demonstrates. For this reason they are heavily used by print media. In fact the highly praised TrueType font standard is a vector format.
As stated above, vector formats are scale invariant; they can be scaled infinitely without loss of detail or clarity whereas raster images loose detail when the are zoomed out, and loose clarity and readability when they are zoomed in.
Vector formats are also typically smaller in file size than comparable raster formats. The overhead of encoding each pixel’s colour means that a raster format increases in size approximately with the square of the resolution, whereas the vector format merely encodes the x.y locations of the geometric primitives. The size of the raster file is the reason almost all raster file formats are compressed.
Raster formats are much better at encoding photographs, in fact this is almost impossible using a vector format.
Raster formats are understood by much more software, so if you have some data there’s a good chance you can display and print it.
Which is better?
Which format is better, raster or vector? The answer is that it depends on what you need it for. Certainly for photography, it would be almost impossible to reproduce the detail of a photograph using a raster format — in fact this is attempt as an artistic rendering to make someone look like a cartoon. If you’re rendering fonts, architectural drawings, logos, and other “drawn” art, vector formats are clearly better.
My assertion is that vector formats are better for most mapping applications.
Geographic Information Systems (GIS) use graphics primitives that are based on vector formats. They add information to these primitives. For example, a line on a map may contain information on what it is intended to represent; a road, a contour, or a creek. The line may not have any explicit style information, but based on what it represents the GIS can render it with the right colour, thickness and transparency so that, with the help of the legend, you can understand it.
All true maps (i.e.: not aerial or satellite imagery) start their lives as vector art. Early maps were hand drawn, and modern maps are rendered on a computer. However, if you have a raster map, you have a rendered image of the map; this could mean that the original vector data has been drawn into a bitmap and saved, or you have a scanned paper map. Either way, the image has been “locked” at whatever resolution it was rendered at, and enlarging it or reducing it can very quickly make it unusable.
If you have the vector data you can zoom in or zoom out and the detail and readability of the map remain usable at every resolution.
Let’s say the map has a lot of detail you don’t need, like building footprints, industrial areas and parks for example. You can’t easily remove them (without some serious Photoshop magic) because they are a part of the image. Even if you remove them, their pixels are the only information in the image about what is at that location on the map.
In a vector format however the graphics primitives exist as independent “structures” on a map. An editor can remove, or re-position them. One can also style them differently. If
The information contained in a raster map is limited. Each pixel of course has a colour, but information on what the pixel represents is limited to the colour, and perhaps some “meta data” contains in the header area of the raster file itself. The result is if you zoom in you get a few pixels, and you have no idea what they mean.
The vector data contained in a GIS file format can contain additional data on every graphics primitive. For example, a line may contain data that indicates what it is intended to represent; a road, a contour line, or a creek. This data can be as detail as necessary, so that a road line can contain information ont when the road was built, what surface is, or even who is responsible for its maintenance.
GIS formats extend this concept even further by categorizing and grouping related graphics primitives into layers. Each layer usually is made up of primitives that are similar in some way, an example being the topographic lines. Adding and removing details from the map becomes as simple as telling the system to remove a layer. Even more important, changing how the map looks becomes as simple as editing the style information for a class of objects, and the entire
It’s clear that vector formats are better as containing the information for a GIS, and are better for dealing with map data in general. The main disadvantage is that you require software that can read and understand these formats. This software also has to expose the power to query the data for the information it contains, or to edit the data if that’s what you require. Software to do this can be expensive, and complicated to learn; hopefully you will find that TrueNorth is neither.