diff --git a/docs/map/index.html b/docs/map/index.html index 5031021..f21f9d2 100644 --- a/docs/map/index.html +++ b/docs/map/index.html @@ -327,7 +327,7 @@ }); 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`, ); @@ -335,9 +335,22 @@ 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 = `
