Skip to content

Format Support ​

This page provides an overview of the geospatial data formats supported by GeoTools and how format support is implemented within the library. GeoTools supports a wide range of vector and raster formats with a focus on standardized, open specifications.

For information about specific data stores, see Data Stores.

Format Support Architecture ​

GeoTools implements a consistent architecture for format support with format-specific implementations that enable a unified API while accommodating the unique characteristics of each format.

SVG
100%

Class Hierarchy ​

The format support is implemented through a hierarchy of classes that provide consistent interfaces for the different formats:

SVG
100%

Vector Data Formats ​

Shapefile ​

Shapefile is a widely used vector data format developed by Esri. GeoTools provides comprehensive support for reading and writing Shapefiles.

Key Components ​

  • ShapefileDataStore: Main class providing access to Shapefile data
  • ShapefileDataStoreFactory: Creates Shapefile data stores
  • ShapefileFeatureSource: Provides access to features from Shapefiles
  • DbaseFileWriter: Writes attributes to DBF files

Features & Capabilities ​

  • Support for all geometry types (Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon)
  • Reading and writing attributes via DBF files
  • Optional spatial indexing for efficient queries (.qix files)
  • Customizable character encoding support for international text
  • Memory mapping option for improved performance
  • Support for .prj files for coordinate reference systems
  • Support for .shx index files

Limitations ​

  • 2GB file size limit for individual files
  • Attribute names limited to 10 characters in DBF format
  • Single geometry type per file
  • Limited data types (no direct support for UUID, XML, arrays, etc.)

GeoPackage Vector ​

GeoPackage is an open, standards-based, platform-independent, portable, self-describing, compact format for transferring geospatial information. It's based on SQLite and supports both vector and raster data.

Key Components ​

  • GeoPackage: Main class for working with GeoPackage files
  • GeoPkgDataStore: Provides access to GeoPackage feature data
  • GeoPkgDialect: SQL dialect for GeoPackage SQLite database
  • GeoPkgDataStoreFactory: Creates GeoPackage data stores

Features & Capabilities ​

  • SQLite-based storage for vector data
  • Spatial indexing using SQLite's R-tree implementation
  • Advanced data types including dates, times, enumerations
  • SQL-based filtering and querying
  • Support for GeoPackage extensions
  • Ability to store both vector and raster data in a single file
  • Metadata tables for describing contents

GeoPackage Structure ​

SVG
100%

Raster Data Formats ​

GeoTIFF ​

GeoTIFF is a public domain metadata standard which allows georeferencing information to be embedded within a TIFF file. It is the most widely used format for raster data in GIS applications.

Key Components ​

  • GeoTiffReader: Reads GeoTIFF files
  • GeoTiffWriter: Writes GeoTIFF files
  • GeoTiffFormat: Format description and access
  • GeoTiffMetadata2CRSAdapter: Converts GeoTIFF metadata to CRS

Features & Capabilities ​

  • Reading and writing georeferenced raster data
  • Support for embedded coordinate reference systems
  • Support for ground control points (GCPs)
  • Overview (pyramid) support for efficient rendering
  • Compression options for reducing file size
  • Support for various pixel types and bands
  • Transparent handling of world files and projection files
  • Support for GDAL metadata tags and PAM datasets

Reading Process ​

SVG
100%

GeoPackage Raster ​

GeoPackage also supports raster data through its tile-based storage model, which is designed for efficient access and web mapping.

Key Components ​

  • GeoPackageReader: Reads raster data from GeoPackage files
  • TileEntry and TileMatrix: Represent tile structure
  • TileReader: Reads individual tiles

Features & Capabilities ​

  • Tile-based storage of raster data
  • Multiple zoom levels (pyramids) for efficient display at different scales
  • Compact storage format
  • Compatibility with web mapping frameworks
  • Unified format for both vector and raster data

Working with Different Formats ​

Reading Vector Data ​

Vector data reading follows a consistent pattern across formats:

// Shapefile
File file = new File("data.shp");
ShapefileDataStore store = new ShapefileDataStore(file.toURI().toURL());
SimpleFeatureSource source = store.getFeatureSource();
SimpleFeatureCollection features = source.getFeatures();

// GeoPackage
Map<String, Object> params = new HashMap<>();
params.put("dbtype", "geopkg");
params.put("database", "data.gpkg");
DataStore store = DataStoreFinder.getDataStore(params);
String typeName = store.getTypeNames()[0];
SimpleFeatureSource source = store.getFeatureSource(typeName);
SimpleFeatureCollection features = source.getFeatures();

Reading Raster Data ​

Similarly, raster data reading follows a consistent pattern:

// GeoTIFF
File file = new File("data.tif");
GeoTiffReader reader = new GeoTiffReader(file);
GridCoverage2D coverage = reader.read(null);

// GeoPackage Raster
File file = new File("data.gpkg");
GeoPackageReader reader = new GeoPackageReader(file, null);
String coverageName = reader.getGridCoverageNames()[0];
GridCoverage2D coverage = reader.read(coverageName, null);

Format-Specific Parameters and Options ​

Shapefile Parameters ​

ParameterTypeDescription
urlURLURL to the .shp file
namespaceURINamespace URI for the feature type
memory mapped bufferBooleanEnable/disable memory mapping
cache and reuse memory mapsBooleanCache and reuse memory maps
create spatial indexBooleanAutomatically create spatial index
charsetCharsetCharacter encoding for DBF file
timezoneTimeZoneTimezone used for date fields
enable spatial indexBooleanUse spatial index if available

GeoPackage Parameters ​

ParameterTypeDescription
dbtypeStringMust be "geopkg"
databaseFileThe GeoPackage file
userStringDatabase user
passwdStringDatabase password
namespaceURINamespace URI for the feature type
Batch insert sizeIntegerNumber of features to insert in a single batch

GeoTIFF Parameters ​

ParameterTypeDescription
INPUT_TRANSPARENT_COLORColorColor to be made transparent
SUGGESTED_TILE_SIZEStringSuggested tile size
WRITE_TIFF_TAGSBooleanWhether to write GeoTIFF tags
SOURCE_URLURLSource URL for the GeoTIFF
COMPRESSIONStringCompression type (e.g., "LZW")
COMPRESSION_QUALITYFloatQuality level for compression

Date/Time Handling in Various Formats ​

Each format has its own approach to handling date and time values:

Shapefile ​

  • Uses fixed-width DBF format
  • Dates are stored in YY-MM-DD format
  • No native support for time or timestamp
  • Timezone handling through the timezone parameter
// Configuring timezone for Shapefile
ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
Map<String, Serializable> params = new HashMap<>();
params.put("url", file.toURI().toURL());
params.put("timezone", TimeZone.getTimeZone("UTC"));
DataStore dataStore = factory.createDataStore(params);

GeoPackage ​

  • Uses SQLite date/time types
  • Follows ISO-8601 format: YYYY-MM-DDTHH:MM:SS.SSSZ
  • Full support for date, time, and timestamp
  • Timezone handling baked into the ISO format
// Date formatting in GeoPackage
static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

Format Support Extensions ​

The GeoTools format support architecture is designed to be extensible. To add support for a new format:

Vector Format Extension ​

  1. Implement DataStoreFactorySpi for format discovery
  2. Extend ContentDataStore for format-specific data store implementation
  3. Implement appropriate FeatureSource and FeatureReader interfaces

Raster Format Extension ​

  1. Extend AbstractGridFormat for format description and capabilities
  2. Extend AbstractGridCoverage2DReader for reading raster data
  3. (Optional) Extend AbstractGridCoverageWriter for writing raster data