protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps

Home Page:https://protomaps.com/docs/pmtiles/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow Customization of OpenLayers Format Parameters

vycius opened this issue · comments

Problem

The PMTiles OpenLayers library currently always sets the format to MVT with default parameters in the code found here: link.

This hardcoding of the MVT format limits the ability to customize OpenLayers format parameters, such as setting idProperty or changing featureClass, which are essential for enabling full editing and geometry support.

Proposed Solution

Modify the library to allow customization of the format and the passing of additional arguments. This would enable users to specify the MVT parameters as needed, providing greater flexibility and control over their OpenLayers configurations.

Current Workaround

A current workaround involves setting the format after initializing the PMTilesVectorSource. For example:

(layer.getSource() as PMTilesVectorSource).format_ = new MVT({
  featureClass: Feature,
  idProperty: 'code',
});

While this method works, it is not an elegant solution. It would be preferable to be able to pass these parameters directly to the PMTilesVectorSource constructor.

v0.5.0 published on NPM: https://www.npmjs.com/package/ol-pmtiles

Thanks!