Class VectorTilesDataStore
- All Implemented Interfaces:
DataAccess<SimpleFeatureType,,SimpleFeature> DataStore
- Direct Known Subclasses:
PMTilesDataStore
This class provides the foundation for creating GeoTools DataStores that read vector tiles from tile archives like
PMTiles or other tiled formats. It bridges between the Tileverse VectorTileStore abstraction and GeoTools'
ContentDataStore architecture.
Architecture:
- Wraps a
VectorTileStorethat provides access to the underlying tile data - Creates one
VectorTilesFeatureSourceper vector layer in the tile metadata - Automatically derives
SimpleFeatureTypefrom layer metadata - Supports spatial filtering, CRS transformation, and zoom level optimization
Features:
- Automatic feature type discovery from TileJSON metadata
- Spatial query optimization using tile extent calculations
- Automatic zoom level selection based on query resolution hints
- CRS transformation support
- Thread-safe concurrent access
Subclass Implementation: Concrete subclasses must provide a VectorTileStore instance through the
constructor. The store handles all tile-specific logic (reading, caching, spatial indexing), while this class handles
GeoTools integration.
Feature Type Mapping: Each vector layer in the tile metadata becomes a feature type. The schema is derived from the layer's field definitions in the TileJSON metadata, with geometry attributes added automatically.
- See Also:
-
VectorTileStoreVectorTilesFeatureSourcePMTilesDataStore- TileJSON Specification
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault value forsetDisplayTileSize(int), matching the Protomaps/MapLibre/Mapbox GL convention.static final GeometryFactoryFields inherited from class ContentDataStore
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, LOGGER, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVectorTilesDataStore(DataStoreFactorySpi factory, VectorTileStore tileStore) Creates a new vector tiles datastore. -
Method Summary
Modifier and TypeMethodDescriptionprotected VectorTilesFeatureSourcecreateFeatureSource(ContentEntry entry) Creates a feature source for a specific vector layer.Creates the list of feature type names available in this datastore.intReturns the tile size (in pixels) that a rendering client is assumed to display each tile at when picking a zoom level for a given screen resolution.VectorTileStoreReturns the underlyingVectorTileStorethat provides access to the tile data.voidsetDisplayTileSize(int displayTileSize) Sets the tile size (in pixels) rendering clients of this dataset are assumed to display each tile at.Methods inherited from class ContentDataStore
createContentState, createSchema, dispose, ensureEntry, ensureFeatureStore, entry, getDataStoreFactory, getEntry, getFeatureFactory, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureTypeFactory, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getFilterFactory, getGeometryFactory, getInfo, getLockingManager, getLogger, getNames, getNamespaceURI, getSchema, getSchema, getTypeNames, name, removeEntry, removeSchema, removeSchema, setDataStoreFactory, setFeatureFactory, setFeatureTypeFactory, setFilterFactory, setGeometryFactory, setNamespaceURI, updateSchema, updateSchema
-
Field Details
-
DEFAULT_GEOMETRY_FACTORY
-
DEFAULT_DISPLAY_TILE_SIZE
public static final int DEFAULT_DISPLAY_TILE_SIZEDefault value forsetDisplayTileSize(int), matching the Protomaps/MapLibre/Mapbox GL convention.- See Also:
-
-
Constructor Details
-
VectorTilesDataStore
protected VectorTilesDataStore(DataStoreFactorySpi factory, VectorTileStore tileStore) throws IOException Creates a new vector tiles datastore.- Parameters:
factory- the factory that created this datastoretileStore- the underlying tile store providing access to vector tiles- Throws:
IOException- if the tile store cannot be initialized or metadata cannot be read
-
-
Method Details
-
getTileStore
public VectorTileStore getTileStore()Returns the underlyingVectorTileStorethat provides access to the tile data.Used by
VectorTilesFeatureSource- Returns:
- the vector tile store
-
getDisplayTileSize
public int getDisplayTileSize()Returns the tile size (in pixels) that a rendering client is assumed to display each tile at when picking a zoom level for a given screen resolution.- See Also:
-
setDisplayTileSize
public void setDisplayTileSize(int displayTileSize) Sets the tile size (in pixels) rendering clients of this dataset are assumed to display each tile at.Protomaps and the MapLibre/Mapbox GL family target 512px, regardless of the tile matrix's own pixel width (typically 256). This can't be derived from the tile data, so it must be configured per dataset.
- Parameters:
displayTileSize- the display tile size in pixels, defaults to 512
-
createTypeNames
Creates the list of feature type names available in this datastore.Each vector layer in the tile metadata becomes a feature type. The names are derived from the layer IDs in the TileJSON metadata.
- Specified by:
createTypeNamesin classContentDataStore- Returns:
- list of feature type names
-
createFeatureSource
Creates a feature source for a specific vector layer.- Specified by:
createFeatureSourcein classContentDataStore- Parameters:
entry- the content entry for the feature type- Returns:
- a new
VectorTilesFeatureSourcefor the layer - Throws:
IOException- if the layer does not exist or cannot be accessed
-