Raster Maps vs. Vector Maps: What’s the Difference?

A guide to rasters, vectors, and why you need to know the difference between the two.

September 3, 2024
Articles

Raster Maps

How does a Raster Map Store Data?

In the early 1930s the word raster was taken from German where it means “screen”.  It should therefore come as no shock that a raster stores data using individual pixels arranged into a grid, like a digital photograph. A simple way to understand how data is stored in this way is by taking a chess board and converting it into computer readable binary - 1 for black, and 0 for white.

The two grids above contain the same information but we can now numerically represent our chessboard with 0s and 1s. It’s easy to then extend this idea to greyscale or monochrome - we simply introduce a range of numbers, 0 to 255, and use them to represent a range of shades from black to white. If you’d then like a colour image, you’ll need three grids stacked on top of each other describing the shade of red, green, and blue (RGB). As each pixel can represent 256 different shades, the three layers of RGB can produce a staggering 256³ = 16,777,216 different colours.

Raster maps then go a step further by relating this data to physical space on Earth. A single pixel will contain the data for a fixed area of land, for example 25km², giving us a pixel height and width of 5km. This is our raster’s resolution. If we then know how many pixels are contained within the raster we know the extent of our image and can encode the corresponding latitude and longitude locations into the pixels. In doing this, it makes it possible to combine multiple rasters or crop out the relevant features of a single raster.

Examples of Raster Maps

A raster map will often come in one of two flavours: a three layer RGB raster or a single layer raster with a key or legend. An example of an RGB raster would be a satellite image of a city, where the features such as buildings and roads are represented in natural colours as if you’re directly looking at them.

RGB image of London. Source: https://terrascope.be/en

On the other hand, you may only care about the land classification - is the pixel I’m looking at grass, water or concrete? This is where a single layer raster would be a better fit, as you could encode your pixel classifications into single numbers, 1, 2, 3, and then include a key linking these back to your classification types. You can could then let the user display the information in any colours they wish

Land classification of London. Source: https://viewer.terrascope.be

Benefits of Raster Maps

  • Raster maps are simple digital images which are supported by almost every device.
  • Rendering a raster image uses little computation.
  • Easy to perform calculations for analysis - they’re just grids of numbers after all!

Drawbacks of Raster Maps

  • Raster maps can be large in file size requiring more bandwidth and storage.
  • Zooming too far will degrade the image quality. There’s only ever a finite amount of pixels.
  • Raster maps are difficult to edit once created. There’s no easy way to go and change building’s footprint.

Vector Maps

How does a Vector Map Store Data?

Vector maps store data as different Geospatial shapes. Each shape is constructed from a point or “node” which represents a single location on planet Earth. An example of data stored as a single node would be an address, which can be located with a latitude and longitude coordinate such as (52.023, 0.241). If you wanted to represent a pathway or road you can introduce more nodes and create a line from multiple locations. This can then be extended to represent buildings, city boundaries, and even countries. All you need is a closed polygon.

Within the vector map there’ll be plenty of metadata and tags including the type of real-world object the vector represents such as street or lamppost  and importantly, what format or projection the coordinates are in.

Examples of Vector Maps

At source, most street maps will be stored in this format. It allows for easy editing and when needed, raster maps can be produced from their vector counterparts. The best example of this is OpenStreetMaps (OSM). At source, the data is stored as vectors to enable anyone from around the world to add map data to the project ; however, when you navigate to openstreetmap.org you’ll be presented with pre-rendered raster images as this enables wide compatibility for any software and hardware alongside pre-stylised map features. The raw vector data that powers OSM can be seen below.

Each building in the image above is a collection of nodes forming a polygon and each road and pathway is a collection of nodes forming a line. Behind the scenes, thousands of calculations are carried out to determine where on the screen the data should be displayed.

Benefits of Vector Maps

  • Maps can be stored in very small, compressed files
  • When zooming in, quality is not degraded as the computer can continue to render the shapes larger.
  • Simple to edit. GIS software can open files and remove single nodes, lines, and polygons with ease.

Drawbacks of Vector Maps

  • As maps are rendered by the user’s device, reasonable compute power needs to be available
  • Continuous data is difficult to estimate. A perfect circle would take an infinite amount of nodes to describe - though this level of precision is rarely needed.

Comparing Raster Maps and Vector Maps

The images below are displaying the same zoomed region of Amsterdam, first in vector format, and second in raster format.

As can be seen, the raster map has lost quality due to being zoomed in to a level beyond what had been pre-rendered by OSM. It does however have stylised roads, buildings, waterways, and points of interest, all of which have been given a defined style based on the tags in the underlying vector data. These features can be also be plotted onto the vector map at the cost of more computation time - a concern which doesn’t exist for the pre-rendered raster map.

For these reasons, online mapping providers will pre-render vector maps into raster maps at multiple different zoom levels, forming a “Tile Pyramid”. When you enter the map, you’ll see a single image covering an entire country, illustrating the outline and very little detail within it. As you zoom, you’ll be sent updated images which have been pre-rendered to contain more detail and your device will tile the images together and display it as a single cohesive map.

Raster or Vector: What Should You Use?

There’s no clear cut answer to this question. The general rule of thumb is if your data is discrete e.g., the outline of a building or a road, use a vector map. If your data is continuous, such as the intensity of a forest fire and its extent, use a raster map. The file size benefits of using a vector map can disappear if the wrong type of data is stored in it!

Another consideration is your user’s hardware. If you’ll be hosting a map on a public website a user could be browsing it on a supercomputer or a toaster - and you’ll need to support them both! In this case, a raster map may be a more suitable format. On the other hand you may want to store the geo-referenced blueprints for your house. In this case, correctness is more important than the speed as which you can display it. There’s a reason they say “raster is faster, but vector is corrector”.

Subscribe To Our Newsletter - Sleek X Webflow Template

Subscribe to our newsletter

Sign up at Naurt for product updates, and stay in the loop!

Thanks for subscribing to our newsletter
Oops! Something went wrong while submitting the form.