What is the difference between raster and vector data?

Raster and vector are two very different but common data formats used to store geospatial data.
Vector data use X and Y coordinates to define the locations of points, lines, and areas (polygons) that correspond to map features such as fire hydrants, trails, and parcels. As such, vector data tend to define centers and edges of features.
Raster data, on the other hand, use a matrix of square areas to define where features are located. These squares, also called pixels, cells, and grids, typically are of uniform size, and their size determines the detail that can be maintained in the dataset. Because raster data represent square areas, they describe interiors rather than boundaries as is the case with vector data.
Vector data are excellent for capturing and storing spatial details, while raster data are well suited for capturing, storing, and analyzing data such as elevation, temperature, soil pH, etc. that vary continuously from location to location. Raster data formats also are used to store aerial and satellite imagery.