FeatureTiles converts vector features stored in a GeoPackage into tile images on demand. It supports Web Mercator (XYZ) and WGS84 tile coordinate schemes. If the feature table has an RTree or GeoPackage spatial index, queries are automatically scoped to the tile’s bounding box for efficiency.
Constructor
An open
GeoPackage instance used to load style extensions and feature indexes.The
FeatureDao for the feature table to render.Output tile width in pixels. Defaults to
TileUtils.TILE_PIXELS_DEFAULT (256).Output tile height in pixels. Defaults to
TileUtils.TILE_PIXELS_DEFAULT (256).Pixel scale factor for high-DPI rendering. Defaults to
1.0.Drawing tiles
drawTile()
Renders the Web Mercator (XYZ) tile at the given coordinates and returns the result. Uses an index query when available, otherwise falls back to a full-table scan.Tile column (x) in the Web Mercator tile grid.
Tile row (y) in the Web Mercator tile grid.
Zoom level.
Optional canvas to draw into directly. When omitted, a new off-screen canvas is created.
Resolves to a
GeoPackageTile containing the encoded image, or null if no features exist in that tile.drawTileWGS84()
Renders a WGS84 (EPSG:4326) tile at the given coordinates. Behaves identically todrawTile() but uses WGS84 bounding boxes.
drawTileQueryAll()
Draws a Web Mercator tile by querying all features in the table regardless of indexing. This can be slow for large tables.close()
Releases the internalFeatureIndexManager and icon caches. Call when done rendering.
Styling properties
Styling is controlled through dedicated Paint objects and numeric properties. CallcalculateDrawOverlap() after changing stroke widths or the point icon to update the tile overlap padding.
pointRadius
Radius in pixels of the circle drawn for each point feature.pointPaint
APaint object controlling the fill color and opacity of rendered points. Default color is #000000FF (opaque black).
pointIcon
An optionalFeatureTilePointIcon that replaces the default circle when set. Set to null to revert to a circle.
linePaint
APaint object controlling the stroke color of line features. Default color is #000000FF.
lineStrokeWidth
Stroke width in pixels for line features.polygonPaint
APaint object controlling the stroke color of polygon outlines. Default color is #000000FF.
polygonStrokeWidth
Stroke width in pixels for polygon outlines.fillPolygon
Whentrue (the default), polygons are filled using polygonFillPaint.
polygonFillPaint
APaint object controlling the fill color of polygons. Default is a very transparent black (#00000011).
Feature limits
setMaxFeaturesPerTile()
Sets the maximum number of features that may be drawn in a single tile. When a tile’s feature count exceeds this value, the tile is not drawn (returnsnull) unless maxFeaturesTileDraw is also set.
Maximum feature count per tile. Set to a large number to effectively disable the limit.
setMaxFeaturesTileDraw()
Sets aCustomFeaturesTile implementation that is called to render a placeholder tile when the feature count exceeds maxFeaturesPerTile.
A custom renderer that accepts tile dimensions and a feature count.
Overlap and scale
calculateDrawOverlap()
Recalculates the pixel overlap added around each tile to prevent geometry clipping at tile edges. Call this after changingpointRadius, lineStrokeWidth, polygonStrokeWidth, or pointIcon.