Skip to content

Commit 173a013

Browse files
rdhyeeclaude
andcommitted
Use clicked point ID for dynamic sample path queries
- Changed from hardcoded pid to using clickedPointId - get_samples_1 and get_samples_2 now return arrays instead of single records - Updates display sections to show data based on selected point - Now fully interactive with map clicks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b4f925c commit 173a013

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tutorials/parquet_cesium.qmd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ async function getGeoRecord(pid) {
195195
196196
async function get_samples_1(pid) {
197197
if (pid === null || pid ==="" || pid == "unset") {
198-
return "unset";
198+
return [];
199199
}
200200
const q = `
201201
SELECT DISTINCT
@@ -215,13 +215,13 @@ async function get_samples_1(pid) {
215215
AND g.otype = 'GeospatialCoordLocation'
216216
AND g.pid = ?
217217
`;
218-
const result = await db.queryRow(q, [pid]);
218+
const result = await db.query(q, [pid]);
219219
return result;
220220
}
221221
222222
async function get_samples_2(pid) {
223223
if (pid === null || pid ==="" || pid == "unset") {
224-
return "unset";
224+
return [];
225225
}
226226
const q = `
227227
SELECT DISTINCT
@@ -245,7 +245,7 @@ async function get_samples_2(pid) {
245245
AND g.otype = 'GeospatialCoordLocation'
246246
AND g.pid = ?
247247
`;
248-
const result = await db.queryRow(q, [pid]);
248+
const result = await db.query(q, [pid]);
249249
return result;
250250
}
251251
@@ -330,11 +330,11 @@ viewof sampleTable = {
330330
}
331331
```
332332

333-
## getGeoRecord (harcoded)
333+
## getGeoRecord (selected)
334334

335335
```{ojs}
336336
//| code-fold: true
337-
pid = "geoloc_7ea562cce4c70e4b37f7915e8384880c86607729";
337+
pid = clickedPointId
338338
testrecord = await getGeoRecord(pid);
339339
```
340340

@@ -346,23 +346,23 @@ ${JSON.stringify(testrecord, null, 2)}
346346
`
347347
```
348348

349-
## Related Sample Path 1 (harcoded)
349+
## Related Sample Path 1 (selected)
350350

351351
```{ojs}
352352
//| echo: false
353-
samples_1 = await get_samples_1(pid)
353+
samples_1 = await get_samples_1(clickedPointId)
354354
md`\`\`\`
355355
${JSON.stringify(samples_1, null, 2)}
356356
\`\`\`
357357
`
358358
```
359359

360360

361-
## Related Sample Path 2 (harcoded)
361+
## Related Sample Path 2 (selected)
362362

363363
```{ojs}
364364
//| echo: false
365-
samples_2 = await get_samples_2(pid)
365+
samples_2 = await get_samples_2(clickedPointId)
366366
md`\`\`\`
367367
${JSON.stringify(samples_2, null, 2)}
368368
\`\`\`

0 commit comments

Comments
 (0)