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

Class TileJSONTileset

app/src/tileset.ts:142–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142class TileJSONTileset implements Tileset {
143 url: string;
144
145 constructor(url: string) {
146 this.url = url;
147 }
148
149 archiveForProtocol() {
150 return undefined;
151 }
152
153 async test() {
154 await fetch(this.url);
155 }
156
157 async getBounds() {
158 const resp = await fetch(this.url);
159 const j = await resp.json();
160 return j.bounds as [number, number, number, number];
161 }
162
163 async getMaxZoom() {
164 const resp = await fetch(this.url);
165 const j = await resp.json();
166 return j.maxzoom;
167 }
168
169 getMaplibreSourceUrl() {
170 return this.url;
171 }
172
173 async isOverlay() {
174 return true;
175 }
176
177 async isVector() {
178 const resp = await fetch(this.url);
179 const j = await resp.json();
180 const template = j.tiles[0];
181 const pathname = new URL(template).pathname;
182 return (
183 pathname.endsWith(".pbf") ||
184 pathname.endsWith(".mvt") ||
185 pathname.endsWith(".mlt")
186 );
187 }
188
189 getStateUrl() {
190 return this.url;
191 }
192
193 getLocalFileName() {
194 return "";
195 }
196
197 async getZxy(z: number, x: number, y: number) {
198 const resp = await fetch(this.url);
199 const j = await resp.json();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…