# Is raster lossy and vector not lossy?

I am new to GIS, in school for it actually, but I come from a photography / graphic design background. So that said, I always thought that vector graphics were not lossy (scale up or down, doesn't matter) and raster graphics were lossy (or have the potential for being lossy if attempted to scale up). It's certainly true in the graphic design world, do the same rules apply to GIS?

Earlier when I was explaining to someone on another website that one of the differences between "raster vs vector" was that they were "lossy vs not-lossy" respectively, another person felt the need to jump in with this:

"You are not correct.

First, raster is usually performed at a fixed resolution and is only lossy with some compression techniques. It's the compression technique, not the raster, which is lossy. Because of compression and difficulty of displaying a variable dataset in vector without losing information, some rasters are more efficient than vectors in displaying info.

Second, vectors can be lossy based on line and area simplification techniques where unnecessary points are removed because they aren't relevant for display scale. It can also be lossy in the precision of a coordinate"

Not really sure what some of that language even means.

Can someone here clarify which one is lossy and which is not lossy?

• `Can someone here clarify which one is lossy and which is not lossy?` Neither: "lossy" and "non-lossy" is (usually) a property of compression techniques. Raster and vector are simply two different types of information. So first you decide whether you want vectors or a pixel matrix, then you decide if you're okay with losing precision during transmission/storage. Traditionally, raster does lend itself better to compression (think of a million pixels with a single black dot in the middle). May 7 '18 at 18:13
• Re, "I come from a ... graphic design background." In graphic design, the artwork is the reality. And, you're right: A vector image has "inifinte" resolution. But in GIS, the terrain is the reality, and either a raster image or a vector image is only an approximation of the terrain. You can zoom in without limit on the details that a vector image contains, but that won't reveal any finer details that are there in reality but not represented in the vectors, and for the details that are represented, zooming in won't make them any more accurate. May 7 '18 at 19:53

These definitions you're using are not accurate:

• not lossy (scale up or down, doesn't matter)
• lossy (or have the potential for being lossy if attempted to scale up)

"Scale up or down, doesn't matter" is a defining characteristic of vector formats and has nothing to do with "lossy" vs "lossless". Similarly, how a raster looks when it's scaled up has nothing to do with whether it's lossless or lossy, it looks different when scaled up because rasters are based on cells(pixels) and scaling them up makes the pixels bigger.

The terms "lossless" and "lossy" apply to data compression techniques. So rasters can be either lossless or lossy depending on the format and the compression scheme used. A TIFF file, for example, can be created with no compression at all, lossless compression using LZW or PackBits, or lossy compression with JPEG. The Esri GRID raster format is compressed using lossless compression and the format doesn't support lossy compression at all.

Vector formats are not "lossy" in the same sense a JPEG is. The person you're quoting is stretching the definition of "lossy" to include things like line smoothing, which does have the effect of making a vector dataset smaller but isn't really a data compression scheme like JPEG is.

You shouldn't think in term of lossy or not to differentiate the two format but rather in term of different use for each format. Also as long as you are not modifying your data neither format is lossy. The real important question is at what scale my data are intended to be used/represented.

A raster have a cell size (could be any size), the data for each cell is (usually) an average of the quantity you mesure in each cell. also raster don't have attribute in the same way as vector data (they store numerical value).

Vector have precise coordinate (but only as precise as you collect then), could represent point, line or polygon and could store any type and any number of attribute.

Raster are ''good'' to describe continuous phenomenon (think elevation or temperature...) over a territories but are ''bad'' for non continuous think (think soil occupation), that's the opposite for vector

Of course you could use raster for soil occupation by coding different type by different values and you could use vector to represent elevation with polygon for each elevation range but you loose the advantage of each type of data

The only case where you could think of lossy the same way as in graphic design is when you represent your data, as you are in fact creating a graphical document. It's true that a vector will always draw perfectly (not really in fact, if a circle will be a circle at all scale a squiggly line will look blurry if too zoomed out) when a raster may have a pixelated look.

• thanks this is a great explanation. However how would a vector circle look "blurry" if zoomed out? May 7 '18 at 17:15
• Vector data doesn't have attributes, either. The vector data is only the geometry itself; it's other formats that include a geometry that have attributes. The vector geometry itself is one attribute among many in several different kinds of data structures (database row, GeoJSON feature, etc.). It's possible to attach additional attributes to rasters, too, in some formats. For example, the raster is only one column in a table in PostGIS. May 7 '18 at 19:59
• @wardr another factor is how vector data is rendered; in graphic design, if you zoom out sufficiently on a detailed vector image, oftentimes the renderer will utterly omit smaller "details" -- so it's quite possible for it to be "lossy"! May 7 '18 at 20:53

That person was correct. Just as with photos, rasters are only lossy in the traditional sense if you compress them.

Vector data can be lossy--in the spatial sense--due to low precision of the data or due to processing tolerances. For example, let's say you're working in ArcGIS. If you run a union on two datasets, you will lose spatial precision up to the given XY tolerance. If you run multiple geoprocessing steps, the tolerances can theoretically be additive. I.e., even if you pass a tolerance of '1 FOOT' to each of your processes, after 10 processes, some of your features could be up to 10 feet from their original location.

That said, rasters have analogous issues, depending on snapping.

A raster being resampled to larger cells would be analogous to simplifying a vector (i.e., removing vertices within some proximity of one another). It's not an identical comparison, unless you are using vector data for continuous coverage of your area of interest (e.g., zoning, land cover, political units, etc.).

Then you have the initial scale issue, which may be what you're referring to. That is, a raster cell seldom (if ever) represents a discrete and homogeneous state within its boundaries. For imagery, a cell's value is essentially the weighted average of reflectance values in a given band. If a shoreline runs through a cell, the cell's spectral values may indicate water, sand, or some spectral combination of the two, which could be something completely unrelated, such as asphalt. In that sense, yes, raster data are lossy--more so than vector data.

So, either data type can be lossy or lossless, depending on how it's used and what data components you're interested in preserving.

• it sounds to me how you are describing it is that vectors can "lose information" in the geoprocessing. But that isn't really being "lossy" in the same sense that it would be for a raster file being scaled up beyond its original resolution, right? May 7 '18 at 17:17