Skip to content
Merged
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
21 changes: 17 additions & 4 deletions docs/map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,30 @@
});
console.debug(`Created ${jgiGoldOrgObjs.length} markers.`);

// Fetch the EMSL MONet JSON (not CSV) file and create a marker for each element of its top-level array.
// Fetch the EMSL MONet JSON (not CSV) file and create a marker for each BERtron entity represented within it.
const monetResponse = await fetch(
`${baseUrlForData}/emsl/map/monet_samples_schema-9-16-2025.json`,
);
const monetObjs = await monetResponse.json();
const monetMarkers = [];
console.debug("Fetching and parsing finished.", { data: monetObjs });
monetObjs.forEach((obj) => {
const latLon = getLatLon(obj);
const identifier = `Project: ${obj["proposal_id"]}, Sampling set: ${obj["sampling_set"]}`;
const url = `https://sc-data.emsl.pnnl.gov/?projectId=${obj["proposal_id"]}`;
// If the object lacks a `coordinates` field (which the BERtron schema says is possible),
// omit the object from the map and display a warning on the JavaScript console.
if (!obj.hasOwnProperty("coordinates")) {
console.warn("Omitting object lacking coordinates:", obj);
return; // skips to the next iteration
}

// If the object lacks an `id` field (which the BERtron schema says is possible),
// use a generic value.
const identifier = obj.hasOwnProperty("id") ? obj["id"] : "Sample";

// At this point, we know the object has a `coordinates` field, so we access it.
const coordinates = obj["coordinates"];
const latLon = getLatLon(coordinates);

const url = obj["uri"];
const popupHtml = `<div class="vstack gap-3 marker-popup"><img src="./img/emsl-100x100.png" alt="Logo"/><div>EMSL MONet Sample<br/><a href="${url}" target="_blank" title="View project" class="identifier">${identifier}</a></div></div>`;
const icon = L.icon({
iconUrl: "./img/emsl-marker.png",
Expand Down