Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
>
Sanborn (Scanned Map, COG)
</button>
<button
data-record-url="https://raw.githubusercontent.com/OpenGeoMetadata/edu.stanford.purl/b74664cbb36fb985fe2ebee8d0d6d9657f06ada1/metadata-aardvark/zy/089/tj/2215/geoblacklight.json"
>
Peatland (Index Map, OpenIndexMaps/GeoJSON)
</button>
</div>
<ogm-viewer></ogm-viewer>
</body>
Expand Down
4 changes: 4 additions & 0 deletions src/utils/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export class References {
return this.references['https://github.com/cogeotiff/cog-spec'];
}

get indexMap() {
return this.references['https://openindexmaps.org'];
}

// List of download links with URL and label
get downloadLinks(): LabelledLinks {
const fieldContents = this.references['http://schema.org/downloadUrl'];
Expand Down
17 changes: 16 additions & 1 deletion src/utils/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const getPreviewLayer = (record: OgmRecord): AddLayerObject => {

// Map source types to layer types using information from the record
const getLayerType = (_record: OgmRecord, source: SourceSpecification): LayerType => {
// For now, we only support raster layers
if (source.type === 'raster') return 'raster';
else if (source.type === 'geojson') return 'fill';
else throw new Error(`Unsupported source type: ${source.type}`);
};

Expand All @@ -26,6 +26,7 @@ const getRecordSource = (record: OgmRecord): AddSourceObject => {
// Methods that create new sources are added here in order of preference
// The first one that returns a valid source will be used
recordCOGSource(record),
recordOpenIndexMapsSource(record),
recordWMSSource(record),
].find(Boolean);
};
Expand Down Expand Up @@ -99,3 +100,17 @@ const createWMSSource = ({
attribution,
};
};

const recordOpenIndexMapsSource = (record: OgmRecord): AddSourceObject => {
const indexMapUrl = record.references.indexMap;
if (!indexMapUrl) return null;

return {
id: record.id,
source: {
type: 'geojson',
data: indexMapUrl,
attribution: record.attribution,
},
};
};