GenerationConfig
Attributes
The lowest zoom for which to generate tiles
The highest zoom for which to generate tiles
The resolution of the tiles to generate
The buffer (as a fraction) to apply to the tiles. The margin on a 1000 resolution tile with a buffer of .1 would be 100
A predicate Column for filtering features, optional
A Column for manipulating the array of features within a tile, optional
A Column for manipulating feature geometries, optional
The maximum number of features to include in each tile, optional
The frequency at which to cache the dataset, optional. E.g 2 means every 2nd zoom level. Default is 2
The storage level to cache the dataset at. Default is DISK_ONLY
The maximum size of the dataset from which to generate tiles, optional
The number of partitions to use in tile generation. Default is 2x the number of worker cores
The frequency (ie number of zoom levels) at which to repartition the dataset. Default behavior not to repartition a certain zooms. Repartitioning helps when the geometries are large relative to the tiles, for example processing a collection of countries to zoom 16
Experimental, Unstable feature. Whether to replace polygons with a point in each tile the Polygon appears in. Default is false
with_suggested_min_zoom()
Sets the minZoom based on heuristics of the input dataframe.
Parameters
The dataframe that will be used along with this Config to generate tiles.
Returns
A new GenerationConfig with the minZoom set based on heuristics of the input dataframe.
with_suggested_max_zoom()
Sets the maxZoom based on heuristics of the input dataframe.
Parameters
The dataframe that will be used along with this Config to generate tiles.
Returns
A new GenerationConfig with the maxZoom set based on heuristics of the input dataframe.
PMTilesCompressionType
Values
Unknown compression type
No compression
GZIP compression
Brotli compression
Zstandard compression
PMTilesConfig
Attributes
The type of tile to generate
The compression type of the tile data. This should match with the actual tile data
The metadata to include in the PMTiles. It should be a serialized JSON object
The compression type of internal structures in the PMTiles
Whether the tiles are clustered. Currently only false is supported
The minimum longitude of the tileset
The minimum latitude of the tileset
The maximum longitude of the tileset
The maximum latitude of the tileset
The zoom level of the center of the tileset
The longitude of the center of the tileset
The latitude of the center of the tileset
PMTilesConfigBuilder
Attributes
A name for the tileset
A description of the tileset
An attribution string for the tileset
A version string for the tileset
The type of tileset in this archive (baselayer or overlay)
The vector tile layer that are in the tiles
Extra metadata to include in the PMTiles header
The type of tiles in the archive
The bounding box of the data in the tileset in lon/lat
The central point of the tileset in lon/lat
The type of compression to apply to each tile’s binary
The type of compression to apply to internal structures in the archive
Whether the tiles are clustered(ie ordered in the archive). Currently only false is supported
PMTilesTileType
Values
Unknown tile type
Mapbox Vector Tiles format
PNG image format
JPEG image format
WebP image format
AVIF image format
PMTilesTilesetType
Values
The tileset is designed to be rendered below other layers
The tileset is designed to be rendered above the base layer
generate()
Generates tiles from a set of features.
The features must have a geometry column of the Geometry type and a layer
column of string type represent what layer that feature belongs in. An optional Integer or Long column id can be
included to persist an ID into the tiles. The features can be of any geometry type. The output dataset will have a
tile column specifying the tile and a feature column containing clipped, simplified features that belong in that
tile, projected into the [0..1] coordinate space of the tile for its x and y values. Geometries should be in the
WGS84 coordinate reference system.
Note that because slippy tiles are based on a Mercator projection, features with latitudes less than -85.0511 or
greater than 85.0511 should not be processed. This is a limitation of slippy tile systems.
Parameters
The features to generate tiles from.
The configuration for generating tiles.
Returns
A DataFrame of tiles ready to be output as MVTs.
write_pmtiles()
Writes a DataFrame of tiles to a PMTiles file.
Parameters
The DataFrame of tiles to write
The path to write the PMTiles file to
The configuration for generating the PMTiles file. If
None, the config will be generated from the features dataframeThe DataFrame of features that the tiles were generated from. This is used to generate the config if one is not provided.
The storage level to cache the tiles DataFrame at. If
None, the DataFrame will not be cached.generate_pmtiles()
Generates and writes PMTiles from a DataFrame of features.
Parameters
The DataFrame of features to generate tiles from.
The path to write the PMTiles file to.
The configuration for generating tiles.
The configuration for generating the PMTiles file.
The storage level to cache the tiles DataFrame at. If
None, the DataFrame will not be cached.Returns
The generated PMTiles.
get_pmtiles_config_builder()
Returns a PMTilesConfigBuilder for creating a PMTilesConfig.
Parameters
The DataFrame of features to generate tiles from.
The path to write the PMTiles file to.
The configuration for generating tiles. If
None, a default config will be used.The configuration for generating the PMTiles file. If
None, a default config will be used.The storage level to cache the tiles DataFrame at. If
None, the DataFrame will not be cached.Returns
An empty PMTilesConfigBuilder.
_add_layer()
Adds a PMTiles layer to a leafmap Map.
Parameters
The layers can be provided as a list of S3 URIs or dicts.The map object to which the layer will be added.
The S3 URI of the PMTiles file.
A descriptive name of the layer. Will default to the file name if not provided.
The style of the layer. See https://leafmap.org/notebooks/82_pmtiles/
Whether or not the layer should be an overlay or base layer.
Whether or not the layer should be shown by default.
Whether or not the map should zoom to the layer when it is added.
build()
Build the PMTilesConfig object. Call this after setting all the desired fields.
Returns
A PMTilesConfig object based on the values set in the builder
from_features_data_frame()
Sets the bounds, center, and layers based on the features in the DataFrame.
Parameters
The DataFrame containing the features used to generate the tiles that will go in the PMTiles
Returns
The builder object with the bounds, center, and layers set based on the features in the DataFrame.
get_quick_config()
Retrieves a default GenerationConfig for generating tiles.
Returns
A default GenerationConfig for generating tiles.
generate_quick_pmtiles()
Generates PMTiles from a DataFrame of features using a quick configuration.
Parameters
The DataFrame of features to generate tiles from.
The path to write the PMTiles file to.
Whether to return a leafmap Map object showing the generated tiles.
Returns
A leafmap Map object showing the generated tiles if render is True.
show_pmtiles()
Shows a set of PMTiles layers on a leafmap Map.
Parameters
The layers to show. see overview for more information
The basemap to use. string. see https://leafmap.org/notebooks/31_search_basemaps/
Returns
A leafmap Map object showing the layers as configured.
with_suggested_min_zoom()
Sets the minZoom based on heuristics of the input dataframe.
Parameter description
The dataframe that will be used along with this Config to generate tiles.
Returns
A new GenerationConfig with the minZoom set based on heuristics of the input dataframe.
with_suggested_max_zoom()
Sets the maxZoom based on heuristics of the input dataframe.
Parameters
Parameter description
The dataframe that will be used along with this Config to generate tiles.
Returns
A new GenerationConfig with the maxZoom set based on heuristics of the input dataframe.

