in src/file_layer.ts [36:61]
async getGeoJson(): Promise<FeatureCollection | undefined> {
const cachedGeoJson = this._emsClient.getCachedGeoJson(this.getId());
if (cachedGeoJson) {
return cachedGeoJson;
}
const format = this.getDefaultFormatType();
const fetchUrl = this.getDefaultFormatUrl();
let geojson;
const fetchedJson = await this._emsClient.getManifest(fetchUrl);
if (fetchedJson) {
if (format === 'geojson') {
geojson = fetchedJson as unknown as FeatureCollection;
} else if (format === 'topojson') {
const meta = this.getDefaultFormatMeta();
const featureCollectionPath = meta?.feature_collection_path ?? 'data';
// @ts-expect-error see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52156
geojson = topojson.feature(fetchedJson, featureCollectionPath) as FeatureCollection;
} else {
return;
}
this._emsClient.cacheGeoJson(this.getId(), geojson);
return geojson;
}
return;
}