Skip to content

Commit 043db38

Browse files
authored
Merge pull request #31 from rdhyee/issue-13-parquet-duckdb
Add geocode search and prevent parquet commits
2 parents bdd0696 + f3e6080 commit 043db38

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ uv.lock
33
plantuml-images
44
docs
55

6+
# Large data files
7+
*.parquet
8+
69
.$*
710

811
# Byte-compiled / optimized / DLL files

tutorials/parquet_cesium.qmd

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ viewof parquet_path = Inputs.text({
3737
});
3838
```
3939

40+
```{ojs}
41+
//| echo: false
42+
viewof searchGeoPid = Inputs.text({
43+
label:"Jump to Geocode",
44+
placeholder: "Paste geocode PID (e.g., geoloc_04d6e816218b1a8798fa90b3d1d43bf4c043a57f)",
45+
width:"100%",
46+
submit:true
47+
});
48+
```
49+
4050
::: {.callout-tip collapse="true"}
4151
#### Using a local cached file for faster performance
4252

@@ -615,6 +625,44 @@ md`Retrieved ${pointdata.length} locations from ${parquet_path}.`;
615625
}
616626
```
617627

628+
```{ojs}
629+
//| echo: false
630+
// Handle geocode search: fly to location and trigger queries
631+
{
632+
if (searchGeoPid && searchGeoPid.trim() !== "") {
633+
const pid = searchGeoPid.trim();
634+
635+
// Look up the geocode in the database
636+
const q = `SELECT pid, latitude, longitude FROM nodes WHERE otype='GeospatialCoordLocation' AND pid=?`;
637+
const result = await db.query(q, [pid]);
638+
639+
if (result && result.length > 0) {
640+
const geo = result[0];
641+
const viewer = content.viewer;
642+
643+
// Fly camera to the location
644+
const position = Cesium.Cartesian3.fromDegrees(
645+
geo.longitude,
646+
geo.latitude,
647+
15000 // 15km altitude for good view
648+
);
649+
650+
viewer.camera.flyTo({
651+
destination: position,
652+
duration: 2.0, // 2 second flight
653+
complete: () => {
654+
// After camera arrives, trigger the click to load data
655+
mutable clickedPointId = pid;
656+
}
657+
});
658+
} else {
659+
// Geocode not found - could display error to user
660+
console.warn(`Geocode not found: ${pid}`);
661+
}
662+
}
663+
}
664+
```
665+
618666
::: {.panel-tabset}
619667

620668
## Map

0 commit comments

Comments
 (0)