Skip to content

Core Architecture ​

The GeoTools Core Architecture defines the foundational components and design principles that support the entire GeoTools library. This document explains the main architectural elements, their relationships, and the overall organization of the GeoTools codebase. For information about specific implementations, refer to the corresponding feature-specific pages.

Overall Architecture ​

GeoTools follows a modular architecture organized around key abstractions for geospatial data handling. The project is structured into several layers, with clear dependencies between components.

SVG
100%

Core Modules ​

The GeoTools library is designed around a set of fundamental modules that provide the foundation for all functionality:

ModulePurposeKey Abstractions
gt-apiCore interfacesDataStore, Feature, FeatureSource, Filter
gt-metadataBase services and utilitiesCitations, Logging, Factory system
gt-referencingCoordinate reference systemsCRS, MathTransform, Position, Bounds
gt-mainDefault implementationsDataStore implementations, Geometry utilities
gt-coverageRaster data handlingGridCoverage2D, GridCoverageReader

These modules form the backbone of GeoTools, with carefully managed dependencies to ensure that higher-level components can be used independently. The gt-api module (formerly gt-opengis) defines the core interfaces that are implemented throughout the library.

Data Model ​

GeoTools implements a comprehensive data model for handling both vector and raster geospatial data.

SVG
100%

Spatial Data Abstractions ​

The spatial data model in GeoTools is built on a few key abstractions:

  1. Feature: The basic unit of vector data, typically representing a geographic entity with attributes and geometry
  2. GridCoverage2D: The basic unit of raster data, coupling a rendered image with spatial reference information
  3. Position: Represents a point in coordinate space (replaced DirectPosition in GeoTools 30.x)
  4. Bounds: Represents a bounding box in coordinate space (replaced Envelope in GeoTools 30.x)
  5. CoordinateReferenceSystem: Defines the spatial reference system for features and coverages

One of the most commonly used implementations is ReferencedEnvelope, which combines JTS Envelope with a coordinate reference system:

SVG
100%

Data Access Framework ​

The GeoTools data access framework provides a consistent API for accessing both vector and raster data from various sources.

SVG
100%

The framework is designed around the following core interfaces:

  1. DataAccess/DataStore: For vector data access

    • ContentDataStore: Base implementation for most file-based data stores
    • JDBCDataStore: Base implementation for database-backed data stores
  2. FeatureSource: Provides query capabilities against vector data

    • FeatureCollection: Result of a query, provides iteration over Features
  3. GridCoverageReader: For raster data access

    • AbstractGridCoverageReader: Base implementation
    • Format-specific implementations (GeoTIFF, ImageMosaic, etc.)

Module Dependencies ​

GeoTools modules have a carefully managed set of dependencies, designed to minimize coupling and prevent circular dependencies.

SVG
100%

The dependency structure is designed to ensure that:

  1. The API module has minimal dependencies
  2. Implementation modules depend on the API but not vice versa
  3. Optional dependencies are clearly marked and isolated
  4. Higher-level modules (like gt-coverage) can depend on lower-level modules (like gt-main), but not vice versa

Factory System ​

GeoTools uses a factory system to instantiate implementations of key interfaces. This allows for:

  1. Separation of interface from implementation
  2. Pluggable implementations
  3. Hints-based customization of implementation selection
SVG
100%

Common usage pattern:

FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Filter filter = ff.equals(ff.property("name"), ff.literal("value"));

Notable Architectural Changes ​

In GeoTools 30.x, a significant architectural change occurred with the removal of the org.opengis package, moving interfaces to org.geotools.api. Key changes included:

  1. Renaming gt-opengis module to gt-api
  2. Moving interfaces from org.opengis.* to org.geotools.api.*
  3. Merging FilterFactory2 into FilterFactory
  4. Replacing DirectPosition with Position
  5. Replacing Envelope with Bounds
  6. Moving styling interfaces to org.geotools.api.style
SVG
100%

Extension Points ​

GeoTools is designed to be extended through several mechanisms:

  1. Plugins: Implement specific DataStore or GridCoverageReader interfaces
  2. Factories: Register custom implementations of core interfaces
  3. Extensions: Add specialized functionality building on core modules

Plugins are discovered through Java's ServiceLoader mechanism with service files located in META-INF/services/.

Conclusion ​

The GeoTools Core Architecture provides a flexible and extensible framework for geospatial data handling. It is characterized by:

  1. A modular design with clear separation of interfaces and implementations
  2. A factory system allowing for pluggable components
  3. Strong abstractions for both vector and raster data
  4. Flexible data access framework supporting various data formats
  5. Comprehensive coordinate reference system support

This architecture forms the foundation for all other GeoTools subsystems and extensions.