Source System
The Source System provides the data pipeline for OpenLayers, defining how map data is fetched, processed, and delivered to layers. This system encompasses tile sources, image sources, vector sources, and various protocols (XYZ, WMS, WMTS, WFS, etc.) that feed data into the rendering pipeline.
For information about how sources integrate with layers, see Layer Architecture. For details on data formats and parsing, see Data Formats and Parsing.
Source Class Hierarchy
The source system is built on a well-defined inheritance hierarchy that separates concerns between different data delivery paradigms.
Core Source Architecture
Source State Management
All sources inherit core functionality from the Source base class, including state management, attribution handling, and projection support.
Tile Sources
Tile sources deliver data in a grid-based tile system, with each tile representing a specific geographic area at a particular zoom level.
Tile Source Architecture
| Source Class | Protocol | Use Case | Key Features |
|---|---|---|---|
| XYZ | HTTP/HTTPS | Standard tile servers | Template URLs, tile grids |
| OSM | HTTP/HTTPS | OpenStreetMap | Preconfigured XYZ source |
| WMTS | OGC WMTS | Standards-compliant | Capabilities-based setup |
| TileWMS | OGC WMS | WMS as tiles | Parameter handling, GetFeatureInfo |
| BingMaps | Bing API | Bing Maps | Quad key addressing, metadata |
| VectorTile | Various | Vector data | MVT, PBF formats |
Tile URL Generation
Tile sources use URL functions to generate requests for specific tile coordinates:
Vector Tile Implementation
Vector tiles require special handling for feature data and format parsing:
Image Sources
Image sources provide single, continuous images that cover larger geographic areas, typically used for untiled services or static imagery.
Image Source Types
Image Loading Pipeline
Protocol Support
The source system supports multiple geospatial protocols and standards through specialized source implementations.
WMS (Web Map Service) Support
WMTS (Web Map Tile Service) Support
The WMTS implementation handles capabilities documents and matrix sets:
| Component | Purpose | Implementation |
|---|---|---|
| optionsFromCapabilities | Parse WMTS capabilities | Auto-configuration from XML |
| createFromWMTSTemplate | URL template generation | Matrix ID, tile coordinates |
| Matrix Sets | Tile grid definition | Projection-specific grids |
| Dimensions | Additional parameters | Time, elevation, custom |
Data Flow and Integration
Sources integrate with the broader OpenLayers architecture through standardized interfaces and events.
Source-to-Layer Integration
Event System and Caching
Sources emit events for state changes and data loading, enabling reactive updates throughout the system:
Specialized Sources
Raster Processing Source
The Raster source enables pixel-level operations across multiple input sources: