Posted on June 27 2021

Why you should use Geopackage instead of Shapefiles?

Shapefiles and Geopackages

Shapefiles are vector data storage models for storing feature classes composed of points, lines and polygons, but never a mixture. It stores information of the location, shape and attributes of geographical features. Each item in a shapefile has attributes that describe it composed of rows, called records and columns called fields and can also store multipart features, in which a single feature includes multiple objects which includes-

  • .shp file stores coordinate data
  • .dbf file stores attribute data
  • .shx file stores a spatial index that speeds drawing and analysis
  • .prj file stores projection information
  • .avl file stores legend
  • .xml file contains metadata

Characteristics of a shapefile

  • Takes up more storage space on your system
  • Shapefiles have a minimum size of 2GB
  • Do not support names in fields longer than 10 characters
  • A shapefile cannot have more than one geometry type in a file.
  • Cannot store data and time in the same field
  • Do not support raster files
  • Do not store NULL values in a field; when a value is NULL, a shapefile will use 0 instead.

A Geopackage is platform-independent format for storing and transferring geospatial information. It is a SQLite based standard format designed for stand-alone databases that holds both raster data and multiple vector data layers in a single file and can be accessible by non-GIS software.

Characteristics of a Geopackage

  • Geopackages are open source, SQLite based database
  • No limitation on the file size and can handle large number of features
  • Can store both raster as well as vector data layers
  • A single Geopackage file can have multiple vector layers with each layer having a different geometry type.

Why choose Geopackages and not Shapefiles?

  1. Shapefile is a multi-file format with minimum of 3 files and several other attached files with different extensions. Sharing a shapefile with someone would be complicated as all the other files attached will also have to be shared. Whereas, Geopackages includes all the information of the layer in a file and is easier to transfer or share.
  2. Compared to shapefiles, the column headers in a geopackage can be full names and right by providing the correct context for each column. A shapefile can only have 10 characters to define the column header.
  3. Geopackages run faster on algorithm outputs compared to shapefiles.
  4. In a geopackage, there is no limit on the file size and can handle large number of features in a smaller file size. A shapefile can handle maximum size of 2 GB and cannot export a vector layer with more features.
  5. A Geopackage stores both raster and vector files whereas, shapefiles can store only vector files.
  6. Geopackages are lightweight and compatible across environments specially in mobile devices. It is 1.1-1.3x lighter in file size compared to shapefiles.