MCPcopy
hub / github.com/protomaps/PMTiles / constructor

Method constructor

openlayers/src/index.ts:112–140  ·  view source on GitHub ↗
(
    options: VectorTileSourceOptions<RenderFeature> & { url: string | Source },
  )

Source from the content-addressed store, hash-verified

110 };
111
112 constructor(
113 options: VectorTileSourceOptions<RenderFeature> & { url: string | Source },
114 ) {
115 super({
116 ...options,
117 ...{
118 state: "loading",
119 url: "pmtiles://{z}/{x}/{y}",
120 format: options.format || new MVT(),
121 },
122 });
123
124 this.pmtiles_ = new PMTiles(options.url);
125 this.pmtiles_.getHeader().then((h: Header) => {
126 const projection = options.projection || "EPSG:3857";
127 const extent = options.extent || extentFromProjection(projection);
128 this.tileGrid =
129 options.tileGrid ||
130 createXYZ({
131 extent: extent,
132 maxResolution: options.maxResolution,
133 maxZoom: options.maxZoom !== undefined ? options.maxZoom : h.maxZoom,
134 minZoom: h.minZoom,
135 tileSize: options.tileSize || 512,
136 });
137 this.setTileLoadFunction(this.tileLoadFunction);
138 this.setState("ready");
139 });
140 }
141}

Callers

nothing calls this directly

Calls 1

getHeaderMethod · 0.45

Tested by

no test coverage detected